fix: cancel scroll completion checks on unmount - #509
Closed
JacquesLeupin wants to merge 1 commit into
Closed
Conversation
JacquesLeupin
marked this pull request as ready for review
July 22, 2026 15:09
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69f2175808
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The fallback watchdog and completion animation frame are stored outside the generic timer registry, so list cleanup could leave them pending and let callbacks run after teardown. Share cancellation between scroll supersession and unmount, and cancel an existing completion frame before replacing it so rapid scroll events cannot orphan an older callback. Clear stored handles after cancellation and cover valid handle zero in regression tests.
JacquesLeupin
force-pushed
the
jleupin/fix-unmount-scroll-watchdog
branch
from
July 22, 2026 15:24
69f2175 to
d2ea33d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LegendListunmounts0Root cause
checkFinishedScrollFallbackstores its watchdog intimeoutCheckFinishedScrollFallback, outside the genericstate.timeoutsregistry that unmount cleanup clears. The completion animation frame is stored separately as well. Both handles could therefore survive teardown and call back into an unmounted list.checkFinishedScrollcould also overwrite the stored animation-frame ID when multiple native scroll events arrived before the next frame. Coalescing completion checks to the latest frame prevents an older callback from becoming unreachable by cleanup.This addresses the reproduced post-unmount watchdog failure in #508. #485 is complementary work for fallback re-arming during a live session.
Validation
pnpm dlx bun test __tests__/core/checkFinishedScroll.test.ts __tests__/core/scrollTo.test.ts __tests__/components/LegendList.props.test.tsx(67 passed)pnpm dlx bun run tsc:srcpnpm dlx bun run lint:fixpnpm dlx bun run lintpnpm dlx bun test(1,514 passed)pnpm dlx bun run build