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 ruleP1stack specificStack: react
cachingarchitecturereact-routerdata-modeling
Isolate per-user data from cacheable, user-agnostic routes
Load per-user state (follow status, personalization) in a separate resource route/loader so user-agnostic pages stay cacheable and per-user data never enters a shared cache.
PR: hegnar-bellsheep-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // profile/layout loader returns BOTH the public profile and this user's follow state |
| 2 | export async function loader() { |
| 3 | return { profile: await getProfile(), following: await getFollowing() }; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // profile/layout loader: public, cacheable |
| 2 | export async function loader() { return { profile: await getProfile() }; } |
| 3 | // myfa-following.ts: separate per-user resource route |
| 4 | export async function loader() { return { following: await getFollowing() }; } |
Explanation (EN)
Objašnjenje (HR)