decaporg / decaporg/decap-cms

Speed extremely slow with populating relation dropdown (several minutes)

Open
#5,920 34 comments 1 reaction 1 assignee Claimed by @demshy View on GitHub
area: extensions/widgets/relation area: performance type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**
We have a template that uses four different list fields - each one allowing the administrator to specify any number of items from a collection to be displayed on a page. The list is defined with a relation field widget, similar to the code below. When there were fewer than 30 items in the respective collections and fewer than 5 or so items selected for each of the four lists this was slow, but acceptable (taking a second or two to populate the relation field dropdown). With 140 and 60 items in each of the referenced collections (stories and news), and 77 selected from one collection and 8 from the smaller collection the waiting time for drop-down population seems to be on the order of several minutes, and this population takes place every time a new item is added to the list, or an item's relation drop-down is clicked to edit it. There seems to be no caching of values between drop-downs despite pulling from the same source:

```
- label: "Featured Stories⁺"
singular_label: "Featured Story"
hint: "⁺will be displayed in the order provided above."
name: "featured_stories"
widget: list
ui: fields
required: true
allow_add: true
fields:
- label: "Altas post/story"
name: "story"
widget: "relation"
collection: "atlas"
search_fields: ["title"]
value_field: "uuid"
display_fields: ["title", "thumb_new"]
hint: "Start typing the title of the Atlas post/story then select from the dropdown list"
- {label: "Don't show thumbnail in list", name: "no_thumb", widget: "boolean", default: false, required: false}
```

**To Reproduce**
1. Create a collection of 150 items,
2. Create a field with the above displayed definition, referencing this collection
3. Start adding items to the list and watch the performance take longer and longer until it's basically unusable for the average site editor

**Expected behavior**
I would expect that the performance for selecting in this sort of situation be good enough at least through a thousand or more items in the collection and at least a few hundred or more items selected from that collection

**Applicable Versions:**

- netlify-cms-app 2.15.54
- netlify-cms-core 2.53.0
- netlify-cms 2.10.174
- Git provider: Gitlab (was also a problem on Github, though may have been very slightly faster on github)
- OS: Windows 10, Linux, MacOS
- Browser version Chrome, Firefox, Safari (all the most recent versions)

**CMS configuration**
See relevant snipet, above

**Additional context**
If required, we can provide a copy of the repository with all config and collection files for analysis to a Netlify CMS engineer (not for direct public release)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.