diff --git a/.changeset/perfect-ads-cough.md b/.changeset/perfect-ads-cough.md new file mode 100644 index 00000000..2e06490f --- /dev/null +++ b/.changeset/perfect-ads-cough.md @@ -0,0 +1,5 @@ +--- +'@xyflow/svelte': patch +--- + +Prevent proxying objects in the store diff --git a/packages/svelte/src/lib/store/initial-store.svelte.ts b/packages/svelte/src/lib/store/initial-store.svelte.ts index 8c2da3cf..ae09b576 100644 --- a/packages/svelte/src/lib/store/initial-store.svelte.ts +++ b/packages/svelte/src/lib/store/initial-store.svelte.ts @@ -110,10 +110,10 @@ export function getInitialStore(null); - panZoom: PanZoomInstance | null = $state(null); - width = $state(signals.width ?? 0); - height = $state(signals.height ?? 0); + domNode = $state.raw(null); + panZoom: PanZoomInstance | null = $state.raw(null); + width = $state.raw(signals.width ?? 0); + height = $state.raw(signals.height ?? 0); nodesInitialized: boolean = $derived.by(() => { const nodesInitialized = adoptUserNodes(signals.nodes, this.nodeLookup, this.parentLookup, { @@ -293,16 +293,16 @@ export function getInitialStore(''); + selectionKeyPressed: boolean = $state.raw(false); + multiselectionKeyPressed: boolean = $state.raw(false); + deleteKeyPressed: boolean = $state.raw(false); + panActivationKeyPressed: boolean = $state.raw(false); + zoomActivationKeyPressed: boolean = $state.raw(false); + selectionRectMode: string | null = $state.raw(null); + ariaLiveMessage = $state.raw(''); selectionMode: SelectionMode = $derived(signals.props.selectionMode ?? SelectionMode.Partial); nodeTypes: NodeTypes = $derived({ ...initialNodeTypes, ...signals.props.nodeTypes }); @@ -317,7 +317,7 @@ export function getInitialStore { - if (this._connection.inProgress) { - return { - ...this._connection, - to: pointToRendererPoint(this._connection.to, [ - this.viewport.x, - this.viewport.y, - this.viewport.zoom - ]) - }; - } else { + if (!this._connection.inProgress) { return this._connection; } + + return { + ...this._connection, + to: pointToRendererPoint(this._connection.to, [ + this.viewport.x, + this.viewport.y, + this.viewport.zoom + ]) + }; }); connectionMode: ConnectionMode = $derived( signals.props.connectionMode ?? ConnectionMode.Strict @@ -392,7 +392,7 @@ export function getInitialStore | null = $state(null); + clickConnectStartHandle: Pick | null = $state.raw(null); onselectiondrag?: OnSelectionDrag = $derived(signals.props.onselectiondrag); onselectiondragstart?: OnSelectionDrag = $derived(signals.props.onselectiondragstart);