Repository navigation
fix(useHistoryTravel): preserve batched history updates - #2978
Merged
crazylxr merged 2 commits intoOct 26, 2026
Merged
Conversation
crazylxr
approved these changes
Oct 26, 2026
crazylxr
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed functional history updates, batched navigation, reset/update ordering, redo invalidation, and history limits. The 18 focused useHistoryTravel tests pass; no blocking issues found.
Validation used the locally installed dependencies; a full build and full-suite coverage check were not run as part of this review.
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.
Type of change
Background and solution
Calling
setValue('first')andsetValue('second')in the same event loses the first value from the history. Both calls read the state from the same render. Batched back/forward calls have the same problem.Use functional state updates so each operation starts from the previous operation's result. Tests cover consecutive updates, navigation, reset followed by an update, redo history, and the history limit.
Validation: all 418 hook tests and 8 use-url-state tests pass. The package build and formatting checks pass.
Changelog
Self Check before Merge