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 ruleP2universalStack: react
uxerror-handlingdata-fetching
Recover from errors by refetching data, not reloading the whole page
On a failed widget request, prefer re-running the data fetch (or re-issuing the token) over forcing a full page reload.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codejavascript
| 1 | const onError = () => window.location.reload(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | const onError = () => { |
| 2 | refetchPosts(); // re-run only the failed request |
| 3 | }; |
Explanation (EN)
Objašnjenje (HR)