From 0c4826a70378de7923bd772b15d481e3c30c530b Mon Sep 17 00:00:00 2001 From: moonbeam-dev <137462692+moonbeam-dev@users.noreply.github.com> Date: Mon, 8 Jan 2024 07:51:44 -0500 Subject: [PATCH] fix(DnD): dragAndDrop EventWrapper.js error: cannot add property 'X', object is not extensible * Fix dragAndDrop EventWrapper.js error: cannot add property 'X', object is not extensible Fix for error: cannot add property 'X', object is not extensible An error appears when trying to modify this.props. The solution is to create a copy of the props using JSON.parse() and JSON.stringify() https://stackoverflow.com/questions/55567386/react-cannot-add-property-x-object-is-not-extensible * Update EventWrapper.js --------- Co-authored-by: martinvu-dev <137462692+martinvu-dev@users.noreply.github.com> --- src/addons/dragAndDrop/EventWrapper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/addons/dragAndDrop/EventWrapper.js b/src/addons/dragAndDrop/EventWrapper.js index 3ed575498..c7ad12deb 100644 --- a/src/addons/dragAndDrop/EventWrapper.js +++ b/src/addons/dragAndDrop/EventWrapper.js @@ -47,7 +47,7 @@ class EventWrapper extends React.Component { .getAttribute('class') ?.includes('rbc-addons-dnd-resize') if (!isResizeHandle) { - let extendedEvent = this.props.event + let extendedEvent = {...this.props.event} extendedEvent.sourceResource = this.props.resource this.context.draggable.onBeginAction(this.props.event, 'move') }