feat(jarl-react): 435 — forward NavOptions through useNavigate - #104
Open
randomdevpete wants to merge 1 commit into
Open
feat(jarl-react): 435 — forward NavOptions through useNavigate#104randomdevpete wants to merge 1 commit into
randomdevpete wants to merge 1 commit into
Conversation
useNavigate always pushed a new location even though the underlying route atom setter accepts NavOptions (replace). Accept an optional second argument and forward it, mirroring the atom's own setter shape, so a replace-navigation no longer needs to drop to useSetAtom(routeAtom). Ticket: 435
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
useNavigatenow accepts an optional second argumentNavOptions(currently just{ replace?: boolean }) and forwards it to the underlying route atom's setter. This mirrors the atom's own signature (set(routeAtom, values, { replace: true })) and eliminates the need to drop touseSetAtom(routeAtom)for replace-navigation.All existing call sites pass params positionally, so the addition is backward-compatible.
Verification
Unit test added verifying that
{ replace: true }callshistory.replaceStaterather thanhistory.pushState.Note on Done-when
The "Done when" checklist includes "Replace the hooks guide's escape-hatch note" but that guide (
packages/docs/src/content/guides/HooksAndLinks.md) lives only on ticket 407's branch, which is currently incode. Once 407 merges, whoever lands it can update the guide to show the direct usage pattern instead of the raw-atom escape hatch.