-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
I don't have much experience with Svelte, so please pardon any inaccuracies in this report.
A variable held in a script, imported into two components (parent and child), mutated by a function in the script, which is called by a function in the parent component, which is passed as a prop into the child component and called by another function, will have a different value depending on whether it is the parent component or the child component that accesses it.
The REPL showcases the issue quite concisely. Click the button multiple times, and look at the console. The numbers printed should be the same each click, but num in Component.svelte doesn't update from its initial state of 0.
I was discussing this with cirilla (gtmnayan) on the Svelte Discord (link to message), and they suspect "[t]hat's a bug with how event delegation is implemented."
Reproduction
Logs
No response
System Info
System:
OS: macOS 14.5
CPU: (8) arm64 Apple M1 Pro
Memory: 2.30 GB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.4.0 - /opt/homebrew/bin/node
npm: 10.8.1 - /opt/homebrew/bin/npm
Browsers:
Chrome: 126.0.6478.128
Edge: 120.0.2210.144Severity
annoyance