decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

TypeError: Cannot read properties of undefined (reading 'brandLogo1')

Open jonathancwhite opened this issue 2 years ago • 0 comments

Describe the bug Preview doesn't work for the Home page but works for other pages. I believe the issue is the way I set up the image fields within the Brands widget, but I am not sure.

To Reproduce Create multiple image fields in one object

Expected behavior Preview working on the home page with multiple image fields

Screenshots Can provide screenshots if needed

Applicable Versions:

  • Netlify CMS version: [email protected]
  • Git provider: git-gateway
  • Browser version: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

CMS configuration

backend:
  name: git-gateway
  branch: main
  commit_messages:
    create: Create {{collection}} “{{slug}}”
    update: Update {{collection}} “{{slug}}”
    delete: Delete {{collection}} “{{slug}}”
    uploadMedia: "[skip ci] Upload “{{path}}”"
    deleteMedia: "[skip ci] Delete “{{path}}”"
local_backend: true
media_folder: static/img
public_folder: /img
collections:
  - name: blog
    label: Blog
    folder: src/pages/blog
    create: true
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    fields:
      - label: Template Key
        name: templateKey
        widget: hidden
        default: blog-post
      - label: Title
        name: title
        widget: string
      - label: Publish Date
        name: date
        widget: datetime
      - label: Description
        name: description
        widget: text
      - label: Featured Post
        name: featuredpost
        widget: boolean
      - label: Featured Image
        name: featuredimage
        widget: image
      - label: Body
        name: body
        widget: markdown
      - label: Tags
        name: tags
        widget: list
    publish: true
    type: folder_based_collection
    sortable_fields:
      - commit_date
      - title
      - date
      - commit_author
      - description
    view_filters: []
    view_groups: []
  - name: pages
    label: Pages
    files:
      - file: src/pages/index.md
        label: Home Page
        name: index
        fields:
          - label: Template Key
            name: templateKey
            widget: hidden
            default: index-page
          - label: Page Title
            name: title
            widget: string
          - label: Image
            name: image
            widget: image
          - label: Image Alt Text
            name: imageAlt
            widget: string
          - label: Heading
            name: heading
            widget: string
          - label: Subheading
            name: subheading
            widget: string
          - label: Hero CTA Title
            name: ctaTitle
            widget: string
          - label: Hero CTA Link
            name: ctaLink
            widget: string
          - label: Secondary CTA Title
            name: ctaTitle2
            widget: string
          - label: Secondary CTA Link
            name: ctaLink2
            widget: string
          - label: Brand Showcase
            name: brands
            widget: object
            fields:
              - label: Brand Logo 1
                name: brandLogo1
                widget: image
              - label: Brand Logo 2
                name: brandLogo2
                widget: image
              - label: Brand Logo 3
                name: brandLogo3
                widget: image
              - label: Brand Logo 4
                name: brandLogo4
                widget: image
              - label: Brand Logo 5
                name: brandLogo5
                widget: image
          - label: Mainpitch
            name: mainpitch
            widget: object
            fields:
              - label: Heading
                name: heading
                widget: string
              - label: Subheading
                name: subheading
                widget: string
              - label: Column 1 Text
                name: col1
                widget: text
              - label: Column 2 Text
                name: col2
                widget: text
              - label: CTA Title
                name: ctaTitle
                widget: string
              - label: CTA Link
                name: ctaLink
                widget: string
              - label: Color
    
...

jonathancwhite avatar Apr 27 '22 00:04 jonathancwhite