statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.7k stars 508 forks source link

Entries list view and edit view loading all Taxonomy terms #10599

Open danielwashbrook opened 1 month ago

danielwashbrook commented 1 month ago

Bug description

After importing a large set of content that includes 19k Taxonomy Terms, the Entries list view and edit view becomes very slow as it loads all the terms as "Statamic\Eloquent\Taxonomies\TermModel" for the filters in the list view and the typeahead field selector on the edit view. image I currently see the following options to solve this:

Thanks!

How to reproduce

Create a collection with a taxonomy term reference. Generate a large body of Terms for that taxonomy and create a few Entries of that collection type. Navigate to the list view of the Collection and subsequently the edit view of one of the entries.

Logs

No response

Environment

Environment
Application Name: Emmys
Laravel Version: 10.48.14
PHP Version: 8.2.19
Composer Version: 2.4.1
Environment: local
Debug Mode: ENABLED
URL: localhost
Maintenance Mode: OFF

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

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 5
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.10.0 PRO

Statamic Addons
rias/statamic-redirect: 3.7.1
statamic/eloquent-driver: 4.5.0
statamic/seo-pro: 6.0.3
stefangalescu/statamic-heroicons: 3.0
thoughtco/statamic-blurhash: 1.2.0

Statamic Eloquent Driver
Asset Containers: eloquent
Assets: eloquent
Blueprints: file
Collection Trees: file
Collections: file
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: file
Revisions: eloquent
Taxonomies: file
Terms: eloquent
Tokens: eloquent

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

marcotesche commented 1 month ago

To add to the description:

For the Edit Entry Page: There are 2 workarounds to address performance issues when dealing with a large number of taxonomy terms:

For the Collection Entries List View: Unfortunately, it seems there isn't a similar configuration option available for the Control Panel page listing all entries in a collection. That page always fetches all terms for all taxonomies associated with the collection to populate plain select fields for the filters.

michaeljhopkins commented 3 weeks ago

I was/am having similar issues. I detailed what I did and learned under this issue

https://github.com/statamic/eloquent-driver/issues/344