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: javascript
statereduxdata-modelingpersistence
Store the data shape that matches how it is used and persisted
Store only the identifiers you actually persist and resolve (e.g. ids saved to a cookie) rather than full entities, unless relations require the whole object.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | // preferences saved to cookie, but storing whole channel objects in state |
| 2 | state.channels = selectedChannels; // ITvChannel[] |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // store ids; resolve full channels from them when needed |
| 2 | state.channelIds = selectedChannels.map(c => c.id); |
Explanation (EN)
Objašnjenje (HR)