Skip to content

[6.x] Only check the selected site when building the navigation sidebar items - #15668

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15667-nav-exists-in
Oct 19, 2026
Merged

jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15667-nav-exists-in

Conversation

@lazerg

@lazerg lazerg commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

This pull request fixes an issue where the CP gets slower the more sites you have, on every page.

When building the Navigation section of the sidebar, CoreNav calls $nav->sites() for each navigation to see if it has a tree in the selected site. sites() loads the tree for every configured site, so with 1,218 sites and 3 navigations that's thousands of tree lookups (and queries with the Eloquent driver) per request.

This PR fixes it by using $nav->existsIn() instead, which only looks up the tree for the selected site. It's the same approach as #14988.

Fixes #15667

@jasonvarga
jasonvarga merged commit 460cb5f into statamic:6.x Oct 19, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CP sidebar checks every site for each navigation

2 participants