is 11 layout.tsx files normal or am i nesting route groups wrong Routing
Came from the pages router about a month ago. I now have (marketing), (app) and (auth) groups, each with a layout, plus per-section layouts under (app) for settings, billing, projects and one per project for the tabs. Eleven layout.tsx files, several of which just render {children} with a wrapper div.
It feels like a lot for an app with maybe 25 pages. Is this what everyone's tree looks like, or have I cargo-culted a structure I do not need?
@awkward_ash · 7mo ago
The trap at eleven layouts is data. Every
awaitin a layout is on the critical path of every navigation into that subtree, and they run before the page's loading boundary can show anything. Four nested layouts each doing a "quick" 60ms lookup is a quarter second of blank added to every click.Audit it: grep your layouts for
await. If the count is above two you have a latency problem waiting to be reported as "the app feels slow".Reply
Report