Repository navigation
fix(history): detach listeners when startup is interrupted - #119
Merged
Merged
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
vincentkoc
marked this pull request as ready for review
November 20, 2026 15:58
…replay * origin/main: fix(history): replace the URL on an unmatched redirect (#115) refactor(tests): consolidate pending invalidation scenarios (#118) fix(loading): accept redirect records without a route location as data (#116) fix(loading): ignore a component import from before stop (#113) # Conflicts: # CHANGELOG.md
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.
What Problem This Solves
A history adapter can replay its current location as soon as the router subscribes. If a state subscriber stops the router during that replay, startup throws and leaves the adapter listening. Restarting on the same adapter can leave two listeners attached.
User Impact
Stopping during replay leaves the router idle. Restarting keeps one listener and the replacement start's context. The public API and adapter contract stay the same.
Why This Change Was Made
Each start owns its listener cleanup even when a synchronous callback interrupts registration. Once the adapter returns its unsubscribe function, an interrupted start detaches its own listener and returns.
Evidence
Both regression cases failed on the base revision. Stopping threw a TypeError, and restarting left two live listeners. Both pass with the fix. The full
pnpm run checkon Node 24.22.1 passed all 75 tests and the installed-tarball smoke test.