mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 15:44:59 +00:00
fix: use the full key par the index for the type
This commit is contained in:
parent
b8f22d3d66
commit
7233e0c002
@ -97,11 +97,17 @@ const DraggedItem = ({
|
||||
const accordionRef = useRef(null);
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
const [parentFieldName] = componentFieldName.split('.');
|
||||
/**
|
||||
* The last item in the fieldName array will be the index of this component.
|
||||
* Drag and drop should be isolated to the parent component so nested repeatable
|
||||
* components are not affected by the drag and drop of the parent component in
|
||||
* their own re-ordering context.
|
||||
*/
|
||||
const componentKey = componentFieldName.split('.').slice(0, -1).join('.');
|
||||
|
||||
const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] =
|
||||
useDragAndDrop(!isReadOnly, {
|
||||
type: `${ItemTypes.COMPONENT}_${parentFieldName}`,
|
||||
type: `${ItemTypes.COMPONENT}_${componentKey}`,
|
||||
index,
|
||||
item: {
|
||||
displayedValue,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user