diff --git a/.changeset/chilly-donkeys-relax.md b/.changeset/chilly-donkeys-relax.md new file mode 100644 index 00000000..bde60469 --- /dev/null +++ b/.changeset/chilly-donkeys-relax.md @@ -0,0 +1,6 @@ +--- +'@xyflow/react': patch +'@xyflow/svelte': patch +--- + +Omit `defaultValue` from `Node`'s and `Edge`'s `domAttributes` to fix type incompatibility when using `WritableDraft` diff --git a/packages/react/src/types/edges.ts b/packages/react/src/types/edges.ts index 2489fb12..175357f9 100644 --- a/packages/react/src/types/edges.ts +++ b/packages/react/src/types/edges.ts @@ -72,7 +72,10 @@ export type Edge< /** * General escape hatch for adding custom attributes to the edge's DOM element. */ - domAttributes?: Omit, 'id' | 'style' | 'className' | 'role' | 'aria-label'>; + domAttributes?: Omit< + SVGAttributes, + 'id' | 'style' | 'className' | 'role' | 'aria-label' | 'defaultValue' + >; }; type SmoothStepEdge = Record> = Edge< diff --git a/packages/react/src/types/nodes.ts b/packages/react/src/types/nodes.ts index 1e6eb80f..fce71470 100644 --- a/packages/react/src/types/nodes.ts +++ b/packages/react/src/types/nodes.ts @@ -29,7 +29,14 @@ export type Node< */ domAttributes?: Omit< HTMLAttributes, - 'id' | 'style' | 'className' | 'draggable' | 'role' | 'aria-label' | keyof DOMAttributes + | 'id' + | 'style' + | 'className' + | 'draggable' + | 'role' + | 'aria-label' + | 'defaultValue' + | keyof DOMAttributes >; }; diff --git a/packages/svelte/src/lib/types/edges.ts b/packages/svelte/src/lib/types/edges.ts index 8b38797e..4e151d05 100644 --- a/packages/svelte/src/lib/types/edges.ts +++ b/packages/svelte/src/lib/types/edges.ts @@ -35,7 +35,7 @@ export type Edge< */ domAttributes?: Omit< SVGAttributes, - 'id' | 'style' | 'class' | 'role' | 'aria-label' + 'id' | 'style' | 'class' | 'role' | 'aria-label' | 'defaultValue' >; }; diff --git a/packages/svelte/src/lib/types/nodes.ts b/packages/svelte/src/lib/types/nodes.ts index 69f2063f..f751153f 100644 --- a/packages/svelte/src/lib/types/nodes.ts +++ b/packages/svelte/src/lib/types/nodes.ts @@ -38,6 +38,7 @@ export type Node< | 'draggable' | 'role' | 'aria-label' + | 'defaultValue' | keyof DOMAttributes >; };