Merge pull request #5538 from xyflow/surpress-svelte-warning

disable eslint rule svelte/prefer-svelte-reactivity for several lines…
This commit is contained in:
Moritz Klack
2025-10-08 20:43:39 +02:00
committed by GitHub
9 changed files with 22 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
'@xyflow/svelte': patch
---
Surpress svelte/prefer-svelte-reactivity warnings

View File

@@ -26,6 +26,7 @@
typeof ResizeObserver === 'undefined' typeof ResizeObserver === 'undefined'
? null ? null
: new ResizeObserver((entries: ResizeObserverEntry[]) => { : new ResizeObserver((entries: ResizeObserverEntry[]) => {
// eslint-disable-next-line svelte/prefer-svelte-reactivity
const updates = new Map(); const updates = new Map();
entries.forEach((entry: ResizeObserverEntry) => { entries.forEach((entry: ResizeObserverEntry) => {

View File

@@ -59,8 +59,10 @@
let container: HTMLDivElement; let container: HTMLDivElement;
let containerBounds: DOMRect | null = null; let containerBounds: DOMRect | null = null;
/* eslint-disable svelte/prefer-svelte-reactivity */
let selectedNodeIds: Set<string> = new Set(); let selectedNodeIds: Set<string> = new Set();
let selectedEdgeIds: Set<string> = new Set(); let selectedEdgeIds: Set<string> = new Set();
/* eslint-enable svelte/prefer-svelte-reactivity */
let panOnDragActive = $derived(store.panActivationKeyPressed || panOnDrag); let panOnDragActive = $derived(store.panActivationKeyPressed || panOnDrag);
let isSelecting = $derived( let isSelecting = $derived(

View File

@@ -1,3 +1,4 @@
/* eslint-disable svelte/prefer-svelte-reactivity */
import { import {
areConnectionMapsEqual, areConnectionMapsEqual,
handleConnectionChange, handleConnectionChange,
@@ -90,3 +91,5 @@ export function useNodeConnections({
} }
}; };
} }
/* eslint-enable svelte/prefer-svelte-reactivity */

View File

@@ -1,3 +1,4 @@
/* eslint-disable svelte/prefer-svelte-reactivity */
import { useStore } from '$lib/store'; import { useStore } from '$lib/store';
import { getContext } from 'svelte'; import { getContext } from 'svelte';
@@ -38,3 +39,5 @@ export function useUpdateNodeInternals(): (nodeId?: string | string[]) => void {
return updateInternals; return updateInternals;
} }
/* eslint-enable svelte/prefer-svelte-reactivity */

View File

@@ -128,7 +128,7 @@
y={node.internals.positionAbsolute.y} y={node.internals.positionAbsolute.y}
{...nodeDimesions} {...nodeDimesions}
selected={node.selected} selected={node.selected}
nodeComponent={nodeComponent} {nodeComponent}
color={nodeColorFunc?.(node)} color={nodeColorFunc?.(node)}
borderRadius={nodeBorderRadius} borderRadius={nodeBorderRadius}
strokeColor={nodeStrokeColorFunc(node)} strokeColor={nodeStrokeColorFunc(node)}

View File

@@ -34,8 +34,8 @@
{#if nodeComponent} {#if nodeComponent}
{@const CustomComponent = nodeComponent} {@const CustomComponent = nodeComponent}
<CustomComponent <CustomComponent
{x} {x}
{y} {y}
{width} {width}

View File

@@ -67,6 +67,7 @@
}; };
}, },
onChange: (change: XYResizerChange, childChanges: XYResizerChildChange[]) => { onChange: (change: XYResizerChange, childChanges: XYResizerChildChange[]) => {
// eslint-disable-next-line svelte/prefer-svelte-reactivity
const changes = new Map<string, Partial<Node>>(); const changes = new Map<string, Partial<Node>>();
let position = change.x && change.y ? { x: change.x, y: change.y } : undefined; let position = change.x && change.y ? { x: change.x, y: change.y } : undefined;
changes.set(id, { ...change, position }); changes.set(id, { ...change, position });

View File

@@ -1,3 +1,5 @@
/* eslint-disable svelte/prefer-svelte-reactivity */
import { import {
infiniteExtent, infiniteExtent,
SelectionMode, SelectionMode,
@@ -477,3 +479,5 @@ function warnIfDeeplyReactive(array: unknown[] | undefined, name: string) {
console.warn(`Use $state.raw for ${name} to prevent performance issues.`); console.warn(`Use $state.raw for ${name} to prevent performance issues.`);
} }
} }
/* eslint-enable svelte/prefer-svelte-reactivity */