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

TypeError: Cannot read property 'map' of undefined #4066

Closed
machadoluiz opened this issue Jul 23, 2020 · 0 comments
Closed

TypeError: Cannot read property 'map' of undefined #4066

machadoluiz opened this issue Jul 23, 2020 · 0 comments

Comments

@machadoluiz
Copy link

Describe the bug
As you can see below, the code works for the most part, but specifically in the Preview pane, when I add a group element (list) in the CMS, it breaks for some reason. I've noticed that the issue happens in the custom preview template, in this line, but I wasn't able to see anything wrong in there. Is there a possible fix to it, please?

I'm posting it here because I couldn't find anyone that had a similar issue. I'm sorry if that's not the right place for this kind of issue, if needed, I can delete.

To Reproduce
I created this public repo with just the code needed, so anyone can easily reproduce.
You can also see this site here.

Expected behavior
Be able to add this group element without breaking the Preview pane.

Screenshots

When adding a group element
Content-Manager

When adding a subgroup element (nested list) - it works as expected
Content-Manager (1)

Applicable Versions:

  • Netlify CMS version: netlify-cms-app@2.12.17
  • Git provider: git-gateway
  • Browser version: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36

CMS configuration

publish_mode: simple
slug:
  encoding: unicode
  clean_accents: false
  sanitize_replacement: "-"
backend:
  name: git-gateway
  branch: master
media_folder: static/images
public_folder: /images
collections:
  - name: pages
    label: Pages
    files:
      - file: src/pages/index.md
        label: Index
        name: index
        fields:
          - label: Groups
            name: groups
            widget: list
            fields:
              - label: Title
                name: title
                widget: string
              - label: Subgroups
                name: subgroups
                widget: list
                fields:
                  - label: Subtitle
                    name: subtitle
                    widget: string
    publish: true
    sortableFields:
      - commit_date
      - commit_author
    view_filters: []

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant