Merge pull request #5448 from xyflow/fix/handle-on-connect-types
fix(handle-on-connect): use correct HandleConnection type
This commit is contained in:
7
.changeset/spotty-cobras-rush.md
Normal file
7
.changeset/spotty-cobras-rush.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@xyflow/react': patch
|
||||
'@xyflow/svelte': patch
|
||||
'@xyflow/system': patch
|
||||
---
|
||||
|
||||
Use correct HandleConnection type for Handle onConnect
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useEffect, useMemo, useRef } from 'react';
|
||||
import {
|
||||
Connection,
|
||||
NodeConnection,
|
||||
HandleType,
|
||||
areConnectionMapsEqual,
|
||||
handleConnectionChange,
|
||||
errorMessages,
|
||||
handleConnectionChange,
|
||||
type NodeConnection,
|
||||
type HandleType,
|
||||
type HandleConnection,
|
||||
} from '@xyflow/system';
|
||||
|
||||
import { useStore } from './useStore';
|
||||
@@ -21,9 +21,9 @@ type UseNodeConnectionsParams = {
|
||||
/** Filter by handle id (this is only needed if the node has multiple handles of the same type). */
|
||||
handleId?: string;
|
||||
/** Gets called when a connection is established. */
|
||||
onConnect?: (connections: Connection[]) => void;
|
||||
onConnect?: (connections: HandleConnection[]) => void;
|
||||
/** Gets called when a connection is removed. */
|
||||
onDisconnect?: (connections: Connection[]) => void;
|
||||
onDisconnect?: (connections: HandleConnection[]) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,6 +112,7 @@ export {
|
||||
type SetCenter,
|
||||
type SetViewport,
|
||||
type FitBounds,
|
||||
type HandleConnection,
|
||||
} from '@xyflow/system';
|
||||
|
||||
// we need this workaround to prevent a duplicate identifier error
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Connection, HandleProps as HandlePropsSystem } from '@xyflow/system';
|
||||
import type { HandleConnection, HandleProps as HandlePropsSystem } from '@xyflow/system';
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { ClassValue, HTMLAttributes } from 'svelte/elements';
|
||||
|
||||
export type HandleProps = HandlePropsSystem & {
|
||||
class?: ClassValue;
|
||||
onconnect?: (connections: Connection[]) => void;
|
||||
ondisconnect?: (connections: Connection[]) => void;
|
||||
onconnect?: (connections: HandleConnection[]) => void;
|
||||
ondisconnect?: (connections: HandleConnection[]) => void;
|
||||
children?: Snippet;
|
||||
} & HTMLAttributes<HTMLDivElement>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
areConnectionMapsEqual,
|
||||
handleConnectionChange,
|
||||
type NodeConnection,
|
||||
type HandleType,
|
||||
type Connection,
|
||||
handleConnectionChange
|
||||
type HandleConnection
|
||||
} from '@xyflow/system';
|
||||
|
||||
import { useStore } from '$lib/store';
|
||||
@@ -13,8 +13,8 @@ type UseNodeConnectionsParams = {
|
||||
id?: string;
|
||||
handleType?: HandleType;
|
||||
handleId?: string;
|
||||
onConnect?: (connections: Connection[]) => void;
|
||||
onDisconnect?: (connections: Connection[]) => void;
|
||||
onConnect?: (connections: HandleConnection[]) => void;
|
||||
onDisconnect?: (connections: HandleConnection[]) => void;
|
||||
};
|
||||
|
||||
type ConnectionMap = Map<string, NodeConnection>;
|
||||
|
||||
@@ -54,7 +54,7 @@ export type {
|
||||
StraightEdgeProps,
|
||||
EdgeTypes,
|
||||
DefaultEdgeOptions,
|
||||
BuiltInEdge,
|
||||
BuiltInEdge
|
||||
} from '$lib/types/edges';
|
||||
export type * from '$lib/types/general';
|
||||
export type { Node, NodeTypes, BuiltInNode, NodeProps, InternalNode } from '$lib/types/nodes';
|
||||
@@ -120,7 +120,8 @@ export {
|
||||
type AriaLabelConfig,
|
||||
type SetCenter,
|
||||
type SetViewport,
|
||||
type FitBounds
|
||||
type FitBounds,
|
||||
type HandleConnection
|
||||
} from '@xyflow/system';
|
||||
|
||||
// system utils
|
||||
|
||||
Reference in New Issue
Block a user