Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

CP sidebar checks every site for each navigation

Đang mở Phù hợp với người mới
#15,667 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@lazerg đang làm issue này rồi.

Từ ngày 18/10/2026.

  • #15668 của @lazerg — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
laravel, mariadb, php
Lĩnh vực
backend, performance

Hướng nghiên cứu

Đọc src/CP/Navigation/CoreNav.php ở đoạn bộ lọc và bản đồ được hiển thị trong issue, sau đó so sánh lệnh gọi được đề xuất với truy vấn một site được giới thiệu trong #14988. Xác nhận rằng thanh bên kiểm tra khả năng sử dụng điều hướng trên site đã chọn mà không quét cây của mọi site. Công việc hoàn tất khi các yêu cầu CP tránh được các truy vấn lặp lại cho từng site, đồng thời khả năng hiển thị điều hướng vẫn chính xác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

multisite performance
Bug description

The CP gets slower as you add sites, even on pages unrelated to navigation.

I seeded 1,218 sites and 3 navigations. Each CP request ran ~3,670 queries. The queries came from src/CP/Navigation/CoreNav.php, which checks every site's tree to find out whether a navigation exists in the selected site.

Proposed fix

This follows the same approach as #14988, which made existsIn() a single-site lookup.

Before:

    ->filter(function ($nav) { // line 115
        return User::current()->can('configure navs')
            || $nav->sites()->contains(Site::selected()->handle());
    })
    ->map(function ($nav) {
        $availableInSelectedSite = Site::hasMultiple()
            ? $nav->sites()->contains(Site::selected()->handle())
            : true;

After:

    ->filter(function ($nav) {
        return User::current()->can('configure navs')
            || $nav->existsIn(Site::selected()->handle());
    })
    ->map(function ($nav) {
        $availableInSelectedSite = Site::hasMultiple()
            ? $nav->existsIn(Site::selected()->handle())
            : true;
How to reproduce
  1. Use multisite with a large number of sites (I seeder 1,218).
  2. Create a few navigations with a tree in one site.
  3. Log in as a super user and open any CP page.
Logs

Environment
Environment
Laravel Version: 13.35.0
PHP Version: 8.5.10
Composer Version: 2.10.2
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Cache: file
Database: mariadb
Logs: stack / daily
Mail: log
Queue: redis
Session: file

Storage
public/storage: NOT LINKED

Laradocs
AI Chat: disabled
Banner: disabled
Caching: enabled
Docs Path: docs
Route Prefix: /communications/cms/help
Search Driver: auto
Theme: auto

Statamic
Addons: 4
License Key: Set
Sites: 1218 (Abbott, Fadel and Denesik, Abbott-Wiegand, Abernathy Group, and 1215 more)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.35.1 PRO

Statamic Addons
statamic/audit-log: 1.1.1
statamic/collaboration: 2.0.1
statamic/eloquent-driver: 5.12.2
statamic/seo-pro: 7.15.1

Statamic Eloquent Driver
Addon Settings: eloquent
Asset Containers: eloquent
Assets: eloquent
Blueprints: eloquent
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Fieldsets: file
Form Submissions: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: eloquent
Taxonomies: eloquent
Terms: eloquent
Tokens: eloquent
Installation

Existing Laravel app

Additional details

No response

Ngôn ngữ chính
PHP
Star
4.9k
Fork
647
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
111

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của statamic/cms

Tất cả issue của statamic/cms

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.