Merge pull request #5592 from svilen-ivanov-kubit/svilen-ivanov-kubit-patch-1
Avoid modifying `node.measured` object, create copy instead
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Always create a new measured object in apply changes.
|
||||||
@@ -125,9 +125,9 @@ function applyChange(change: any, element: any): any {
|
|||||||
|
|
||||||
case 'dimensions': {
|
case 'dimensions': {
|
||||||
if (typeof change.dimensions !== 'undefined') {
|
if (typeof change.dimensions !== 'undefined') {
|
||||||
element.measured ??= {};
|
element.measured = {
|
||||||
element.measured.width = change.dimensions.width;
|
...change.dimensions,
|
||||||
element.measured.height = change.dimensions.height;
|
};
|
||||||
|
|
||||||
if (change.setAttributes) {
|
if (change.setAttributes) {
|
||||||
if (change.setAttributes === true || change.setAttributes === 'width') {
|
if (change.setAttributes === true || change.setAttributes === 'width') {
|
||||||
|
|||||||
Reference in New Issue
Block a user