Skip to content
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

Else block's store value doesn't get updated, if content has a transition #5573

Closed
VS-X opened this issue Oct 23, 2020 · 1 comment · Fixed by #5591
Closed

Else block's store value doesn't get updated, if content has a transition #5573

VS-X opened this issue Oct 23, 2020 · 1 comment · Fixed by #5591

Comments

@VS-X
Copy link

VS-X commented Oct 23, 2020

Describe the bug
A bit difficult to describe. Suppose you have this code:

{#if $loading}
    <div class="spinner" />
{:else}
    {#each $store as element}
  	<p transition:slide class="name">{element}</p>
    {/each}
{/if}

First render will be correct, however when the value of store changes (e.g. via .set) - the each block (inside else) does not seem to get the updated value of store. Transition plays out, but the elements remain the same. {@debug $store} statement inside else doesn't get triggered. $: console.log($store); shows that the store does update correctly every time.
If you remove transition:slide from element in each - everything start to work perfectly.

To Reproduce
Click on the checkbox that asynchronously updates the store value. Check the console for @debug vs $: console.log info. Remove transition:slide to see how it should work.
https://svelte.dev/repl/49cef205e5da459594ef2eafcbd41593?version=3.29.4

Expected behavior
Store value should be read correctly inside of else + each block and elements should be drawn with an animation

Severity
Annoying but avoidable - either do not use transition, or avoid else block (replacing it with an if block works just fine)

@Conduitry
Copy link
Member

This is fixed in 3.29.5 - https://svelte.dev/repl/49cef205e5da459594ef2eafcbd41593?version=3.29.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants