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 ruleP2stack specificStack: Next.js App Router
nextjsnot-foundlayout
Use a soft 404 component when notFound() would break layout
In app-router layouts, returning a not-found UI component can keep the layout and client scripts alive where notFound() would tear them down; choose deliberately and comment why.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | if (!ticker) return notFound(); // breaks layout client scripts |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | // Soft 404: keep layout and client scripts running, notFound() would break them |
| 2 | if (!ticker) return <TickerNotFound />; |
Explanation (EN)
Objašnjenje (HR)