Previous from runed has side-effects (returns old value, and updates to new in finally block, see https://github.com/svecosystem/runed/blob/main/packages/runed/src/lib/utilities/previous/previous.svelte.ts#L20), so use in effect that track same reactive value is unsafe.
Therefore, in watchPresenceChange, first call:
const hasPresentChanged = state.present.current !== state.previousPresent.current;
Returns old value, and set to new (because we use inside watch that track state.present.current).
Then, when we call:
if (state.previousPresent.current && isAnimating) {
state.previousPresent.current contains current value, not previous.
Other bugs introduced in #1924:
display calculated ONLY when ref changed (before PR we took the current value when needed)
handleAnimationEnd uses cached animation name (before PR we took the current animation name), so any animation end of the ref triggers unmount
- Dead code:
getAnimationName returns the animation name or "none", so this.styles.animationName is always available:
const currAnimationName =
// is dead code
this.styles.animationName || getAnimationName(this.opts.ref.current);
Therefore, getAnimationName ALWAYS called with forceRefresh=true, and WeakMap animationNameCache is not needed => getAnimationName is equivalent to getComputedStyle(node).animationName || "none".
Previousfromrunedhas side-effects (returns old value, and updates to new in finally block, see https://github.com/svecosystem/runed/blob/main/packages/runed/src/lib/utilities/previous/previous.svelte.ts#L20), so use in effect that track same reactive value is unsafe.Therefore, in
watchPresenceChange, first call:Returns old value, and set to new (because we use inside
watchthat trackstate.present.current).Then, when we call:
state.previousPresent.currentcontains current value, not previous.Other bugs introduced in #1924:
displaycalculated ONLY when ref changed (before PR we took the current value when needed)handleAnimationEnduses cached animation name (before PR we took the current animation name), so any animation end of the ref triggers unmountgetAnimationNamereturns the animation name or "none", sothis.styles.animationNameis always available:Therefore,
getAnimationNameALWAYS called withforceRefresh=true, and WeakMapanimationNameCacheis not needed =>getAnimationNameis equivalent togetComputedStyle(node).animationName || "none".