Netlify-cms: relation widget performances

Created on 25 May 2020  路  5Comments  路  Source: netlify/netlify-cms

Describe the bug
I switched from ncw-file-relation widget to the latest relation widget that has been recently extended to support folder to file collections relationship. Before the switch the performances were acceptable even with big JSON files. The new relation widget, instead, stays in waiting state forever.
To Reproduce

  1. Take a json file (e.g. data/cities.json), representing all the italian municipalities (almost 8,000) with an id and a name keys.
  1. Define a file and a folder collections like the following:
collections
  - label: lookups
    name: lookups
    files:
      - label: cities
        name: cities
        file: data/cities.json
        fields:
          - label: cities
            label_singular: city
            name: cities
            widget: list
            fields:
              - label: Name
                name: name
                widget: string
              - label: id
                name: id
                widget: hidden
  - label: Folder Collection 
    name: folder_collection
    folder: content/folder_collection
    create: true
    identifier_field: id
    slug: '{{city}}'
    summary: '{{city}}'
    editor:
      preview: false
    fields:

      - label: id
        name: id
        widget: ncw-id

      - label: City
        name: city
        widget: relation
        collection: lookups
        file: cities
        searchFields: ['cities.*.name']
        displayFields: ['cities.*.name']
        valueField: cities.*.name
  1. Create a new entry for the folder collection
  2. you'll wait forever (the browser tab does not respond anymore)

Expected behavior

The same folder to file relationship, mutatis mutandis, implemented by using ncw-file-relation widget works like a charm

Applicable Versions:

  • netlify-cms-app 2.12.13
  • Git provider:GitHub
  • OS: Ubuntu 18.04
  • Browser version: chrome Version 83.0.4103.61 (Official Build) (64-bit)

CMS configuration

See above

Additional context

I suspect the relation widget has the same performance issue with folder to folder collections relationship, because I experience a very slow response time with not such a large number of entries in the referenced folder collection.

@d4rekanguok (I added you here because you are the author of the ncw-file-relation widget and you collaborated a lot in adsorbing its features in the latest relation widget.

cities.zip

extensionwidgets

All 5 comments

Thanks for the sample file @magomimmo, I'll give it a try and see if I can find the issue.

Hi @d4rekanguok I think this is the same issue as #3752 regarding file-to-file relationship case as well.

Hi @d4rekanguok did you have the opportunity to take a look at this issue. The perfomance issue of the relation widget is pervasive no matter if you create a folder to folder relation, a folder to file relation or even a file to file relation.

Also experiencing very slow performance with relation widget.
collection "assessments" is a folder of ~800 items

- { label: "Available Standards", name: "standards", required: false, widget: "relation", multiple: true, collection: "assessments",
          searchFields: ["title"], valueField: "title", displayFields: ["title","description"] }

There are several issues with the relation widget at the moment related to performance.

  1. The select dropdown is not virtualised.
  2. The query API saves all results in the redux store (we could only save the limit https://www.netlifycms.org/docs/widgets/#relation):
    https://github.com/netlify/netlify-cms/blob/09b6668c5ed6a58e27466eb30b0fb98c72f5f4ba/packages/netlify-cms-core/src/actions/search.ts#L219
  3. When a user enters a search term the limit is ignored:
    https://github.com/netlify/netlify-cms/blob/09b6668c5ed6a58e27466eb30b0fb98c72f5f4ba/packages/netlify-cms-widget-relation/src/RelationControl.js#L202
Was this page helpful?
0 / 5 - 0 ratings