Skip to content

feat(jarl-react): 435 — forward NavOptions through useNavigate - #104

Open
randomdevpete wants to merge 1 commit into
masterfrom
task-435-usenavigate-forward-navoptions
Open

feat(jarl-react): 435 — forward NavOptions through useNavigate#104
randomdevpete wants to merge 1 commit into
masterfrom
task-435-usenavigate-forward-navoptions

Conversation

@randomdevpete

Copy link
Copy Markdown
Owner

Summary

useNavigate now accepts an optional second argument NavOptions (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 to useSetAtom(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 } calls history.replaceState rather than history.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 in code. Once 407 merges, whoever lands it can update the guide to show the direct usage pattern instead of the raw-atom escape hatch.

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
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.

1 participant