Min Idzelis 4aa31d38bf
fix(web): svelte regression - cancel video preview fetch when bind:this is cleared early (#27713)
fix(web): cancel video preview fetch when bind:this is cleared early

In Svelte 5.53.9, `bind:this` is now cleared earlier in the unmount
sequence ("better bind:this cleanup timing"). The video thumbnail's
$effect was relying on the old order to read the bound `player` element
and clear its `src` to abort the in-flight `/api/assets/{id}/video/playback`
range request — but the bind is now `undefined` by the time the effect
runs, so the cleanup is silently skipped. The detached <video> keeps
its src, and Firefox does not abort an in-flight media fetch when the
element is detached/GC'd. Long-lived 206 range requests then saturate
Firefox's 6-connection HTTP/1.1 per-host limit and freeze the timeline
(see #27585).

Capture the player reference inside the effect and tear down via the
effect cleanup return — Svelte runs the prior cleanup (with the captured
ref) before `bind:this` is cleared. Use the canonical
`pause() / removeAttribute('src') / load()` sequence which actually aborts
the fetch in Firefox, even on a detached element.

Fixes #27585

Change-Id: I4d9fba859955f5c54f603c345e61d4206a6a6964
2026-04-15 20:18:59 -05:00
..
2026-03-02 11:35:53 +00:00
2025-12-20 21:07:07 -06:00
2026-04-15 16:33:52 -04:00
2026-04-15 16:33:52 -04:00
2026-04-15 16:33:52 -04:00
2026-04-14 16:18:12 +00:00
2026-04-14 16:18:12 +00:00
2026-03-26 13:22:14 -04:00
2026-01-19 12:07:31 -05:00
2026-04-15 16:33:52 -04:00
2026-03-26 13:22:14 -04:00