Skip to content

Commit

Permalink
fix(DnD): dragAndDrop EventWrapper.js error: cannot add property 'X',…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
  • Loading branch information
moonbeam-dev and moonbeam-dev authored Jan 8, 2024
1 parent 0bd5044 commit 0c4826a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/addons/dragAndDrop/EventWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down

0 comments on commit 0c4826a

Please sign in to comment.