decaporg / decaporg/decap-cms

List widget with +200 options refuses to load completely

Open
#4,738 2 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**
I have a `list` widget (country picker) with more than 200 entries.
2 issues occur:
1. When editing an already existing record, the value in the `country` field (let's say `united_kingdom`) to which this `list` is writing/reading appears at the top of the list, before the A.
2. After clicking, the options appear, but when scrolling it always gets stuck in the 20th item. When searching though, it works.

Not sure if these 2 are related though.

**To Reproduce**
1. Have a `list` field
2. Give it a list of more than 200 options
3. Save a record with a value that's below the 20th position on the list
4. Go back to edit that record

**Expected behavior**
All options to be available, or at least for it to lazy load them as I scroll.

**Screenshots**
![Screenshot 2020-12-17 at 18 45 24](https://user-images.githubusercontent.com/4265830/102531116-bc676a00-4099-11eb-9191-42ef777aa095.png)

**Applicable Versions:**

- Netlify CMS version: 2.14.6
- Git provider: GitHub
- OS: macOS 11.0.1
- Browser version: Brave v1.16.76
- Node.JS version: 12.17.0

**CMS configuration**
```yml
collections:
- name: 'data'
label: 'Data'
files:
- label: 'Countries'
name: 'country_list'
file: '_data/country_flags.yml'
fields:
- name: 'country_flags'
label: 'Country flags'
widget: 'list'
summary: '{{name}}'
field:
name: 'name'
label: 'Name'
widget: 'string'

- label: 'People'
name: 'people_list'
file: '_data/people.yml'
fields:
- name: 'people'
label: 'People'
widget: 'list'
summary: '{{name}}'
fields:
- name: 'name'
label: 'Name'
widget: 'string'

- name: 'country'
label: 'Country'
widget: 'relation'
collection: 'data'
multiple: false
file: 'country_list'
search_fields: ['country_flags.*']
display_fields: ['country_flags.*']
value_field: 'country_flags.*'

```

`_data/country_flags.yml`:
```yml
country_flags:
- abu_dhabi
- afghanistan
- albania
- algeria

- united_kingdom

```

`_data/people.yml`:
```yml
people:
- name: 'John Doe'
country: 'united_kingdom'
```

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.