-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:content-managerSource is core/content-manager packageSource is core/content-manager packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members
Description
Bug report
Required System information
- Node.js version: 16.17.0
- NPM version: 8.15.0
- Strapi version: 4.5.0
- Database: mysql v8
- Operating system: macOs 12.5
Describe the bug
When a Relation component is used in a Dynamic Zone, reordering the Relation component will lead to a blank screen with following error:
TypeError: i is not iterable
Steps to reproduce the behavior
- create Relation component
- create a Dynamic Zone which use that Relation component, and also any other component type
- in Content Manager, reorder the added Relation component among other components in the same Dynamic Zone
Expected behavior
Reordering a Relation component in Dynamic Zone won't lead to a blank screen
Screenshots
Code snippets
suggest to change this line —
Line 140 in b169f6f
| set(draftState, initialDataPath, uniqBy([...value, ...initialDataRelations], 'id')); |
from
set(draftState, initialDataPath, uniqBy([...value, ...initialDataRelations], 'id'));
set(draftState, initialDataPath, uniqBy([...value, ...(initialDataRelations || [])], 'id'));
So it wont spreading an undefined initialDataRelations (which its index in dynamic zone is changed) when reordering the Relation component
Metadata
Metadata
Assignees
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:content-managerSource is core/content-manager packageSource is core/content-manager packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members
