-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
{#key} not working inside {#each}/{#if} #6688
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
Comments
This does work in contrast (I simply output the key Edit: even with the bug fixed your REPL doesn't look Svelte-like to me. You are basically imperatively controlling the reactivity by setting |
it doesn't matter that this is code that has some real world usage, the point is that it doesn't work as expected, and this is clearly BUG.
for me it's valid Svelte as well as for Svelte's compiler itself. |
I 100% agree that this is a bug and I didn't say otherwise. I'm just trying to advocate patterns that fit Svelte better than the classic approach of imperatively updating everything (jQuery, Backbone, even React to some degree). |
More real life example and very close to what I'm trying to do: https://svelte.dev/repl/f5df58cacfba4c71a81b3072ae4ad955?version=3.42.4 It works when I don't want to store the evaluated data, "time passed" in the example" and just display it using the returned value of a function. And I'm using Besides this point, as said in the documentation (
So I also included the transition examples. Transition when And I don't know what's going on but transition looks also buggy. |
Here's a more Svelte-like version with a Edit: in a real application I'd suggest having |
Also doesn't work inside Update the issue title? |
I spent a lot of time wondering why the |
A workaround I'm using is to add |
pretty sure this was resolved in #7422 https://svelte.dev/repl/d4112f1ae05046bdb48be42b62cc4c8d?version=3.47.0 |
It was, thanks for noticing! |
Describe the bug
{#key} and its body that work doesn't work inside {#each} block.
I want to display the duration passed every second by calculation instead of assigning a value to an object in an array and triggering update with assignment.
Reproduction
https://svelte.dev/repl/d4112f1ae05046bdb48be42b62cc4c8d?version=3.42.4
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: