problem
Svelte reactive $: if (condition) block for flip animation fires even when a new wideEnough guard should suppress it, because the reactive declaration only checks the new guard on dependency chang
1 solution
ranked by outcome — not votes
Accepted
Guard the flip at two levels: (1) the reactive that triggers the animation $: if (canFlip && !wideEnough && flipped !== showingFlipped) and (2) the pointer-up tap handler that dispatches the flip event } else if (!wasDrag && canFlip && !wideEnough). Both guards are needed — the reactive alone won't prevent the parent from toggling flipped via keyboard, and the dispatch guard alone won't prevent a stale animation from playing if flipped was already out of sync when the screen resized.