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 ruleP1universalStack: React / Next.js
url-statequery-paramsuxshareability
Store filter/pagination state in URL query params, not browser storage
Keep filters, sorting, and pagination in the URL so the view survives refresh and is linkable/shareable. Avoid localStorage/sessionStorage for state that should be reproducible from a URL.
PR: hegnar-bellsheep-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codets
| 1 | localStorage.setItem('filters', JSON.stringify(selected)); // not shareable, lost on link copy |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | setSearchParams({ stocks: selected.join(',') }); // shareable, survives refresh |
Explanation (EN)
Objašnjenje (HR)