-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bindings don't work inside {#each reactiveThing as thing} #2444
Comments
Hi, I had a shot at this and managed to get the compiler to generate 3 invalidates - one for each dependency and one for the reactive declaration. Some tests didn't pass if I emitted invalidates only for the dependencies. Here's the commit: mrobakowski@8e470fa |
Also, I believe I found another bug while trying to reduce the example https://svelte.dev/repl?version=3.1.0&gist=c4b48ccfb869a6915a3def99b3fbbd2d. With my commit |
invalidate dependencies of reactive declarations
Thank you! I adapted your solution in #2694. Reopening this (autoclosed) issue so that we can address the second bug you found — you're right, the compiler thinks p(changed, ctx) {
if ((changed.foo) && t5_value !== (t5_value = ctx.foo.name.w)) {
set_data(t5, t5_value);
}
} ...which means |
It was fixed in 3.2.1 and above. |
@Panya the original issue was fixed, but https://svelte.dev/repl?version=3.1.0&gist=c4b48ccfb869a6915a3def99b3fbbd2d still doesn't behave like it should. |
In <script>
let name = { w: 'world' };
$: foo = { name }
</script>
<svelte:body on:click={() => foo.name.w += "!"}/>
<h1>Hello {name.w}!</h1>
<h2>{foo.name.w}</h2> I really don't think that we should expect the compiler to consider modifications to |
In a case like this...
...where
filtered
is derived fromtodos
, toggling an individual input doesn't affect anything else that depends ontodos
. Demo here.That's because this code gets generated:
We should instead invalidate the ultimate dependencies of
filtered
rather thanfiltered
itself:(While
hideDone
doesn't need to be invalidated here, I'm not certain we can reliably determine that statically. Needs more thought.)The text was updated successfully, but these errors were encountered: