Skip to content

fix: preload cancel actually cancels image loads (v0.2.3.3)#7

Open
lemonicefate wants to merge 1 commit intomainfrom
fix/preload-abort-cleanup
Open

fix: preload cancel actually cancels image loads (v0.2.3.3)#7
lemonicefate wants to merge 1 commit intomainfrom
fix/preload-abort-cleanup

Conversation

@lemonicefate
Copy link
Copy Markdown
Owner

Summary

  • state.preloadAbort (AbortController) was dead code — new Image() cannot subscribe to an AbortSignal, so cancelPreload() was a silent no-op. Rapid procedure switches kept zombie image loads consuming bandwidth.
  • Replace state.preloadAbort with state.preloadImages: []; cancelPreload() now sets img.src = '' on each tracked Image (telling the browser to abort the load) and clears the array.
  • One unit test added asserting that cancelPreload() zeros every img.src and empties the array.

Test plan

  • npm test — 43/43 passing (42 pre-existing + 1 new cancelPreload test)
  • No Playwright / network tests run (remote environment)
  • VERSION bumped 0.2.3.2 → 0.2.3.3
  • CHANGELOG entry added under [0.2.3.3] - 2026-05-08
  • TODOS.md AbortController entry updated to Completed v0.2.3.3

https://claude.ai/code/session_01E7NL3UfbiRzDWcxQYpGDub


Generated by Claude Code

state.preloadAbort (AbortController) was dead code — new Image() cannot
subscribe to AbortSignal, so cancelPreload() was a silent no-op. Rapid
procedure switches kept zombie image loads consuming bandwidth.

Replace with state.preloadImages array; cancelPreload() sets img.src=''
on each tracked Image (telling the browser to stop loading) then clears
the array. One unit test added to cover the cancellation behaviour.

https://claude.ai/code/session_01E7NL3UfbiRzDWcxQYpGDub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants