Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1stack specificStack: react
routingurl-statehistorynavigation
Push URL state instead of replacing it when back navigation must work
When syncing filters/pagination to the URL, push history entries (not replace) so the browser back button restores the previous state.
PR: hegnar-forum-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | const [page, setPage] = useQueryState('page', parseAsInteger); |
| 2 | // default replaces history -> back button skips states |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const [page, setPage] = useQueryState( |
| 2 | 'page', |
| 3 | parseAsInteger.withOptions({ history: 'push' }) |
| 4 | ); |
Explanation (EN)
Objašnjenje (HR)