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).
fullstack ruleP1universalStack: universal
error-handlingmutationscorrectnessstate
Confirm a mutation succeeded before triggering dependent updates
Check that a delete/update request actually succeeded before refreshing derived state, so the UI doesn't reflect a change the server rejected.
PR: hegnar-forum-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | await deleteTransaction(id); |
| 2 | refreshCashBalance(); // runs even if delete failed |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const res = await deleteTransaction(id); |
| 2 | if (res.ok) refreshCashBalance(); |
Explanation (EN)
Objašnjenje (HR)