sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.39k stars 4.1k forks source link

outroing if_blocks cannot receive updates #4683

Open pushkine opened 4 years ago

pushkine commented 4 years ago

outroing if_blocks will not receive any update from the tick they get outroed on render_simple : https://svelte.dev/repl/3abed636ab2d456882e49b1db35c677f?version=3.20.1 render_compound : https://svelte.dev/repl/5e950ff7951f4afc9b627aa9832fae5b?version=3.20.1

render_simple does have the following comment in the compiler

// no `p()` here — we don't want to update outroing nodes,
// as that will typically result in glitching

it's been there since the initial commit 2 years ago

I don't really see why it couldn't be fixed, might give it a try in a few days

furudean commented 3 years ago

I ran into this today. I'm trying to conditionally set a class to play a "completion" animation as a fade out starts, but the class never gets set as described by this bug.

{#if $isVisible}
  <div
    class="loading-progress"
    class:finished={$isVisible === false}
    out:fade={{ delay: 600 }}
  />
{/if}

Are there any workarounds to this? I don't think I can get the behavior I want with this bug.

furudean commented 3 years ago

As an aside - setting a delay on the transition blocks updates too. Before the full rework it might be worth to look into if it's possible to allow state to update during a delay, as a separate PR.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

9ParsonsB commented 2 years ago

Is this still being worked on? Is there a workaround?

furudean commented 2 years ago

Issues with no traction like this are pretty far down in the to-do for the core team. Pull requests are always welcome!