Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation widget slow on initial load #4635

Open
sveinpg opened this issue Nov 26, 2020 · 2 comments
Open

Relation widget slow on initial load #4635

sveinpg opened this issue Nov 26, 2020 · 2 comments
Labels
area: extensions/widgets area: performance type: bug code to address defects in shipped code

Comments

@sveinpg
Copy link

sveinpg commented Nov 26, 2020

Describe the bug
We're using the relations widget to select authors for articles. This was fine to begin with. However, as the number of authors increased the load time increased drastically.

From other issues I understand that each a request is sent for each file and those should be cached after the initial load. However, our authors typically open this widget once.

Number of authors in collection: ~200

To Reproduce
Assuming the collections exist and one of the collections have relation to another collection

  1. Create a new item (or select an existing one)
  2. Click the dropdown

Expected behavior
Faster load time. A couple of seconds for example.

A possible solution could be that the search functionally limited the number of requests.

Applicable Versions:

  • Netlify CMS version: 2.13.3
  • Browser version: Latest chrome and firefox

CMS configuration

collections:
    - name: post_javascript
      label: 'Post: JavaScript'
      folder: post/javascript
      create: true
      summary: '{{post_year}}/{{post_day}}: {{title}}'
      fields:
          - { label: 'Calendar', name: 'calendar', widget: 'hidden', default: 'javascript' }
          - {
                label: 'Year',
                name: 'post_year',
                widget: 'number',
                default: 2020,
                valueType: 'int',
                min: 2018,
                max: 2021,
            }
          - {
                label: 'Day',
                name: 'post_day',
                widget: 'number',
                default: 1,
                valueType: 'int',
                min: 1,
                max: 24,
            }
          - { name: title, label: Title }
          - { name: image, label: 'Link to image', required: false }
          - { name: ingress, label: 'Ingress', widget: markdown, required: false }
          - { name: description, label: 'SEO Description', widget: text, required: false }
          - { name: body, label: Body, widget: markdown }
          - name: links
            label: 'Relevant links'
            widget: list
            fields:
                - { name: title, label: Title }
                - { name: url, label: Url }
          - name: authors
            label: 'Authors'
            widget: list
            field:
                {
                    label: 'Author',
                    name: 'author',
                    widget: 'relation',
                    collection: 'authors',
                    searchFields: ['title'],
                    valueField: 'title',
                    displayFields: ['title'],
    - name: authors
      label: Authors
      folder: authors
      create: true
      fields:
          - { name: title, label: Name }
          - {
                name: socialMediaLink,
                label: 'Link to social media (twitter, linkedin etc.)',
                required: false,
            }
          - { name: 'company', label: 'Company', default: 'Bekk' }
@sveinpg sveinpg added the type: bug code to address defects in shipped code label Nov 26, 2020
@banyudu
Copy link
Contributor

banyudu commented Apr 1, 2021

@sveinpg This question occurs to me, too.
If you have only one field (author) in the list, you can use a relation widget with multiple: true instead of a list of relations.

          - name: authors
            label: 'Author',
            widget: 'relation',
            multiple: true, # accepts multiple values
            collection: 'authors',
            searchFields: ['title'],
            valueField: 'title',
            displayFields: ['title'],

However, it didn't help with multiple fields inside a list.

@taineriley1
Copy link
Contributor

Hi @sveinpg @banyudu @erezrokah,

We are experiencing similar issues with this widget and would also like the performance improved. This widget is very useful for connecting entries together, and I've seen several issues in this repo referencing it.

Thanks,
Taine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: extensions/widgets area: performance type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

4 participants