Description
Describe the bug
Hi
I am not 100% sure if this is really a bug or if I am misinterpreting something here.
I had to create a REPL to reproduce the issue and I think that something with how reactivity triggers is not right.
The description within the REPL explains what happens in detail, but:
Using <button disabled={original?.name === to_edit.name}>click</button>
stops re-evaluating under some circumstances.
Extracting this into a derived statement like:
let disabled = $derived(disabled={original?.name === to_edit.name});
<button {disabled}>click</button>
fixes things.
Reproduction
All in all it seems more complex, as even the use of the loading
variable in Dialog.svelte
changes the behavior (removing it from the disabled={loading || disabled}
will fix things too).
And it also only appears to be the case for such nested components. If one changes all the <Button...
components in the Dialog.svelte
to <button>
--> one level less nesting, reactivity works again.
https://svelte.dev/playground/87f3c3d1769d4236bc31b0d340462e50?version=5.35.0
Logs
System Info
System:
OS: Linux 6.12 Void
CPU: (12) x64 AMD Ryzen 5 3600X 6-Core Processor
Memory: 35.38 GB / 62.73 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.0 - /usr/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 11.4.1 - /usr/bin/npm
pnpm: 10.11.0 - /usr/bin/pnpm
Browsers:
Brave Browser: 137.1.79.126
Chromium: 138.0.7204.92
npmPackages:
svelte: ^5.35.0 => 5.35.0
Severity
annoyance