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: any
paginationrealtimestatecorrectness
Don't mutate global counts/order from events that affect off-page items
When real-time events arrive for items not on the current page, be careful decrementing totals or moving items to position 1; reconcile against the actual paginated view so counts and order stay correct.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | removeThreadFromList(threads, id); // may not be on this page |
| 2 | setCount(c => c - 1); // decrements anyway |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const next = removeThreadFromList(threads, id); |
| 2 | if (next.length !== threads.length) setCount(c => Math.max(0, c - 1)); |
Explanation (EN)
Objašnjenje (HR)