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: typescript
performancecachingcomputationrendering
Persist an expensive computation instead of recomputing it client-side every render
If the server already runs an expensive algorithm (e.g. diff/LCS) and stores the result, store the derived fields too rather than recomputing them on every client render.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | // server ran LCS diff and stored words; client re-runs it on every render |
| 2 | const diff = computeLcsDiff(cleaned, original); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | // store status (unchanged/added/removed) alongside words; client just reads it |
| 2 | words.map((w) => <Word status={w.status} />); |
Explanation (EN)
Objašnjenje (HR)