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: react
performanceintersection-observerhydration
Use IntersectionObserver threshold 0 for lazy hydration
For hydrate/load-on-scroll, keep the observer threshold at the default 0 so work starts the moment the element touches the viewport, not after it's partly visible.
PR: hegnar-web · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codejavascript
| 1 | new IntersectionObserver(cb, { threshold: 0.5 }); // hydrate too late |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | new IntersectionObserver(cb); // threshold defaults to 0 |
Explanation (EN)
Objašnjenje (HR)