The PR moves the user after a save with window.location.assign('/settings'), or a raw <a href> that reloads the app. The repo already has router helpers — Link, useNavigate, router.push, or a typed paths helper — that keep the client cache, the pending state, and the scroll or focus behavior the rest of the app uses. The hard jump drops that, and it can skip a leave-guard the router already wired.
I've started treating a raw location change as a missed router helper, not as a simpler redirect. The page may still open. The client transition is why the helper is there.
Why the hard jump shows up
Vanilla JS examples use window.location or a plain anchor. The model can write that without finding useNavigate or the app Link. Your helpers may live under a routes module, which is easy to miss if the prompt only says "go to settings after save."
You also skip query-string and base-path helpers. A handmade /settings?tab=profile string drifts from the typed path the rest of the app uses.
A simple routing policy
- In-app navigation uses the existing Link or navigate helper
-
Do not call
window.location.assignorhref =for an internal route - Build paths with the existing path helper, not a handmade string
- External URLs still use a real anchor, with the repo's external-link pattern
A hard jump is acceptable for a full document change the router does not own, such as a download or a logout that must clear the document. Internal app routes are not that case.
What to put in the prompt
Use the existing router helpers (Link, useNavigate, or router.push) for this in-app navigation.
Do not use window.location or a raw anchor for an internal route.
Build the path with the existing path helper if we have one.
If this must be a full document load, say why; do not default to it.
Paste one existing navigation call. In review, search the diff for window.location, location.href, and in-app <a href> that is not the shared Link.
Reject / send back
Reject
- An internal redirect that uses
window.location - A handmade path string next to an existing path helper
- A raw anchor that reloads the SPA for an in-app route
- A navigate call that bypasses an existing leave-guard with no comment
Accept
- Navigation that uses the existing Link or navigate helper
- A path built with the existing path helper
- A documented full-document jump for a case the router does not own
Top comments (0)