Netlify-cms: Relation widget not showing collection options in drop-down when editing a page

Created on 15 Jul 2020  路  1Comment  路  Source: netlify/netlify-cms

Describe the bug
When editing an existing page that uses a relation widget, the widget doesn't populate the list of options when the field is selected. They can be searched for, but not chosen manually from the list.

To Reproduce
In NetlifyCMS, open a page with a relation widget that already has a value for that field. Click the field, and only the existing value will be shown, not all the other possibilities.

Expected behavior
The field should show a menu of all the collection's options, in addition to the ability to search manually.

Screenshots
This happens when clicking the field (the value that's currently stored is displayed, alone):
image

But this should happen when the field is clicked (all options displayed):
image

Applicable Versions:

  • Netlify CMS version: 2.0.0
  • Git provider: GitHub
  • OS: Windows 10
  • Browser version: Firefox 79b7

CMS configuration
The relevant widget configuration is within the news and blog collection definitions:

- {label: "Author", name: "author", widget: "relation", collection: research-team, displayFields: [name], valueField: name, searchFields: [name], required: false}

Full config:

backend:
  name: git-gateway
  repo: myrepo/website
  branch: master
  identity_url: "https://www.myurl.com/.netlify/identity"
  gateway_url: "https://www.myurl.com/.netlify/git"
  squash_merges: true
# publish_mode: editorial_workflow

# publish_mode: editorial_workflow
media_folder: "assets/uploads"

site_url: https://www.myurl.com
logo_url: https://www.myurl.com/assets/images/cms-logo.png

collections:
  - name: "pages"
    label: "Pages"
    folder: "_pages"
    create: false
    slug: "{{slug}}"
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Address", name: "permalink", widget: "string"}
      - label: "Header image"
        name: "header"
        widget: "object"
        fields:
          - {label: "Header image", name: "overlay_image", widget: "image", required: false}
          - {label: "Header image caption", name: "caption", widget: "string", required: false}
      - {label: "Body", name: "body", widget: "markdown", required: false}
      - {label: "Page layout", name: "classes", widget: "string", required: false}
  - name: "about"
    label: "About section pages"
    folder: "_pages/about"
    create: false
    slug: "{{slug}}"
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Address", name: "permalink", widget: "string"}
      - label: "Header image"
        name: "header"
        widget: "object"
        fields:
          - {label: "Header image", name: "overlay_image", widget: "image", required: false}
          - {label: "Header image caption", name: "caption", widget: "string", required: false}
      - {label: "Body", name: "body", widget: "markdown", required: false}
      - {label: "Page layout", name: "classes", widget: "string", required: false}
  - name: "news"
    label: "News" 
    folder: "_posts" 
    create: true 
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    fields: 
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Author", name: "author", widget: "relation", collection: research-team, displayFields: [name], valueField: name, searchFields: [name], required: false}
      - {label: "Publish Date", name: "date", widget: "datetime", timeFormat: false}
      - {label: "Tags", name: "tags", widget: "select", multiple: true, options: ["Publications", "Presentations", "Events", "Related projects", "Recruitment", "Teaching"], required: false}
      - {label: "Featured Image", name: "thumbnail", widget: "image", required: false}
      - {label: "Body", name: "body", widget: "markdown", required: false}
      - {label: "Categories", name: "categories", widget: "hidden", default: ["news"]}
  - name: "blog" 
    label: "Blog"
    folder: "_blog" 
    create: true 
    slug: "{{slug}}" 
    preview_path: blog/{{slug}}
    fields: 
      - {label: "Layout", name: "layout", widget: "hidden", default: "blog_post"}
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Author", name: "author", widget: "relation", collection: research-team, displayFields: [name], valueField: name, searchFields: [name], required: false}
      - {label: "Publish Date", name: "date", widget: "datetime", timeFormat: false}
      - label: "Header image"
        name: "header"
        widget: "object"
        fields:
          - {label: "Header image", name: "overlay_image", widget: "image", required: false}
          - {label: "Header image caption", name: "caption", widget: "string", required: false}
      - {label: "Body", name: "body", widget: "markdown", required: false}
  - name: "research-team"
    label: "Research team"
    identifier_field: name
    folder: "_research_team"
    create: true
    slug: "{{slug}}"
    preview_path: about/research-team/
    fields:
      - {label: "Name", name: "name", widget: "string"}
      - {label: "Position/title", name: "position", widget: "string", required: false}
      - {label: "Affiliate?", name: "affiliate", widget: "boolean", required: false, default: false}
      - {label: "Rank on team page", name: "sort_order", widget: "number", required: true}
      - {label: "Photo", name: "photo", widget: "image", required: false}
      - {label: "Email", name: "email", widget: "string", required: false}
      - {label: "Website", name: "website", widget: "string", required: false}
      - {label: "Twitter", name: "twitter", widget: "string", required: false}
      - {label: "Body", name: "body", widget: "markdown", required: false}
      - {label: "identifier_field", name: "identifier_field", widget: "hidden", default: "name"}
  - name: "books"
    label: "Books"
    folder: "_books"
    create: true
    slug: "{{slug}}"
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Authors tagline", name: "tagline", widget: "string", required: false}
      - {label: "Publication date", name: "date", widget: "datetime", timeFormat: false, required: false}
      - label: "Cover image"
        name: "header"
        widget: "object"
        fields:
          - {label: "Header image", name: "overlay_image", widget: "image", required: false}
      - {label: "Publisher", name: "publisher", widget: "string", required: false}
      - {label: "Publisher URL", name: "publisher_url", widget: "string", required: false}
      - {label: "Open access download URL", name: "open_access_download_url", widget: "string", required: false}
      - {label: "Body", name: "body", widget: "markdown", required: false}

Additional context

extensionwidgets bug

Most helpful comment

This is now released in [email protected]

>All comments

This is now released in [email protected]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dur41d picture dur41d  路  3Comments

BerkeleyTrue picture BerkeleyTrue  路  3Comments

ciokan picture ciokan  路  3Comments

noelmace picture noelmace  路  3Comments

Narno picture Narno  路  3Comments