Skip to content

Dynamic zone breaks after upgrading from 4.9.2 to 4.11.0 #16966

@jastrand

Description

@jastrand

Bug report

Required System information

  • Node.js version: 16
  • NPM version: 6
  • Strapi version: 4.11.0
  • Database: postgres
  • Operating system: ios

Describe the bug

After upgrading from 4.9.2 to 4.11.0 strapi admin breaks with "Woops! Something went wrong. Please, try again" after trying to use a component in the dynamic zone.

Steps to reproduce the behavior

  1. In the strapi admin ui, go to any collection type using dynamic zone.
  2. Click on any of the components in the dynamic zone to add it
  3. See error "Woops! Something went wrong. Please, try again" and the console logs:
TypeError: Cannot read properties of undefined (reading 'attributes')
    at Object.entries.reduce (content-manager.4e46c41a.chunk.js:6660:67)
    at Array.reduce (<anonymous>)
    at findAllAndReplace (content-manager.4e46c41a.chunk.js:6651:39)
    at content-manager.4e46c41a.chunk.js:6782:40
    at produce (main.e40cee3e.js:45810:15892)
    at reducer (content-manager.4e46c41a.chunk.js:6728:32)
    at Object.fi [as useReducer] (main.e40cee3e.js:75945:451)
    at exports.useReducer (main.e40cee3e.js:86305:274)
    at EditViewDataManagerProvider (content-manager.4e46c41a.chunk.js:7052:56)
    at Xh (main.e40cee3e.js:75942:137)

Expected behavior

Expected to be able to use components in the zone :)

Screenshots

How the UI looks like before click:

image

How the ui looks when click on any of the components:

image

Code snippets

This is one example of the schema for one of the components:

{
  "collectionName": "components_landing_pages_big_numbers",
  "info": {
    "displayName": "Big Numbers",
    "description": "",
    "icon": "bold"
  },
  "options": {},
  "attributes": {
    "header": {
      "type": "text",
      "required": false
    },
    "items": {
      "type": "component",
      "repeatable": true,
      "max": 4,
      "min": 2,
      "component": "landing-pages.big-number-item"
    },
    "disclaimer": {
      "type": "text"
    },
    "backgroundColor": {
      "type": "enumeration",
      "enum": [
        "None",
        "Yellow",
        "Alpha"
      ],
      "default": "None"
    }
  }
}

My package json:

"dependencies": {
    "@strapi-community/strapi-provider-upload-google-cloud-storage": "^4.5.6",
    "@strapi/plugin-graphql": "4.11.0",
    "@strapi/plugin-i18n": "4.11.0",
    "@strapi/plugin-seo": "^1.9.1",
    "@strapi/plugin-users-permissions": "4.11.0",
    "@strapi/strapi": "4.11.0",
    "knex": "2.4.0",
    "pg": "8.5.1",
    "slugify": "^1.5.3",
    "strapi-plugin-duplicate-button": "^1.1.7",
    "styled-components": "^5.3.3"
  },

Let me know if I can provide any more context, thanks

Metadata

Metadata

Assignees

Labels

issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:content-managerSource is core/content-manager packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions