Key block behavior #13979
Unanswered
megashrieks
asked this question in
Q&A
Key block behavior
#13979
Replies: 1 comment
-
|
Kind of. The Try switching the transition to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm going through the Svelte tutorial and in the Key block lesson
The lesson states that whenever the expression in the
Keychanges, the block is destroyed and recreated.In the example the following code is shown, which works great
{#key i} <p in:typewriter={{ speed: 10 }}> {messages[i] || ''} </p> {/key}However I was experimenting and found that the following code behaves strangely
{#key i < 5} <p in:typewriter={{ speed: 10 }}> {messages[i] || ''} </p> {/key}The expectation is that the typewriter animation is triggered on
index == 5and when snapping back toindex == 0But the message is not updated in the
<p>after index 5 and it snap back to 0 later. Is this the expected behavior?Beta Was this translation helpful? Give feedback.
All reactions