Open Karosmiy opened 1 month ago
it may be related to #13168
It seems like the problem might be indeed in the requestAnimationFrame
as it seems to be used for animations. And browsers might throttle or disable it when tabs are in the background.
Looked through the internals a bit a here is what I've found:
loop
: https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/internal/client/dom/elements/transitions.js#L381Wondering what could be done on Svelte side to avoid this problem?
AFAIK we only use rAF for tick
based transitions and the spring motion. If you're not using these things, then we aren't likely using rAF. You can check by monkey patching globalThis.requestAnimationFrame = () => debugger
and seeing if it fires.
Describe the bug
I'm encountering an issue with the flip animation on a list of elements in Svelte. The list is dynamically updated based on WebSocket messages. Here's what happens:
Reproduction
Steps to Reproduce:
Expected Behavior:
Actual Behavior:
transform: matrix(1, 0, 0, 1, 0, 1394
, which positions them incorrectly.Additional Information:
It seems that requestAnimationFrame might be paused while the tab is inactive, causing this issue. Sorting the list while the tab is active again fixes the problem, but this is not an ideal workaround. Currently, I'm working around this issue by disabling the flip animation when the tab becomes inactive and re-enabling it when the tab becomes active again. However, this is more of a temporary fix.
Logs
No response
System Info
Severity
annoyance