-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
Prior to 5.39.0, awaiting an async function inside a function assigned to a @const worked without issue. From 5.39.0 onward, even though console logging shows that both the parent and child functions are getting called with the right values, the actual component doesn't seem to be updating/rerendering, as if the activeTab assignment did nothing.
Things that seem to change behavior:
- Moving the
await doSomething()before theactiveTab = tab.idfixes it (but in our case,doSomethingactually relies onactiveTabbeing changed first, so this doesn't work for us) - Making
switchTaba function in the script section (instead of inline) and then using<button onclick={() => switchTab(tab)}>fixed it, this is what we have done to fix things on our end
Reproduction
Works on 5.38.10: https://svelte.dev/playground/9edd553009364fc7b6f6031a756b7acf?version=5.38.10
Broken from 5.39.0: https://svelte.dev/playground/9edd553009364fc7b6f6031a756b7acf?version=5.39.0
Broken in latest: https://svelte.dev/playground/9edd553009364fc7b6f6031a756b7acf?version=latest
(switch from Tab 1 to 2 to 3. Working version changes text all the time, broken version gets stuck after one click)
Logs
System Info
System:
OS: macOS 15.6.1
CPU: (14) arm64 Apple M4 Pro
Memory: 534.53 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.1 - ~/.asdf/installs/nodejs/22.15.1/bin/node
Yarn: 1.22.22 - ~/.asdf/installs/nodejs/22.15.1/bin/yarn
npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
pnpm: 10.17.0 - ~/.asdf/installs/nodejs/22.15.1/bin/pnpm
Browsers:
Brave Browser: 140.1.82.170
Chrome: 140.0.7339.186
Safari: 18.6
npmPackages:
svelte: ^5.39.3 => 5.39.3Severity
annoyance