Description
Using Puck, defining a slot field with a name that might exist in other object (such as metadata) causes drag‑and‑drop to crash. Renaming the field to breadcrumbSlot fixes the issue immediately.
Environment
- Package: @puckeditor/core
- Version: ^0.21.x
- Framework: React
- Usage: custom editor with slot fields
Steps to Reproduce
- Define a component with a slot field named breadcrumb.
fields: {
breadcrumb: { type: 'slot' }
},
defaultProps: {
breadcrumb: []
}
- Insert the component in the editor.
- Drag it (or perform a DnD operation).
Expected
- Drag‑and‑drop should work normally.
Actual
- Crash with:
TypeError: arr.some is not a function
at containsPromise
at walkField
at walkObject
Notes
- Raw data and defaultProps contain arrays as expected.
- The non‑array value appears only inside the DnD pipeline, before render.
- Renaming breadcrumb → breadcrumbSlot fixes the crash.
- Suggests a collision with an internal field or reserved name.
Proposed Fix
- Add a defensive guard in mapFields / containsPromise for slot values:
- If a slot value is not an array, treat it as [] or log a warning.
- Alternatively, document breadcrumb (and other internal names) as reserved.
- Better: namespace internal metadata to avoid collisions.