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:
Moritz Klack
2025-11-25 13:03:27 +01:00
committed by GitHub
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@xyflow/react': patch
---
Always create a new measured object in apply changes.
+3 -3
View File
@@ -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') {