chore(store): add current connection result closes #2916
This commit is contained in:
@@ -93,6 +93,8 @@ export function handlePointerDown({
|
||||
connectionHandleId: handleId,
|
||||
connectionHandleType: handleType,
|
||||
connectionStatus: null,
|
||||
connectionTargetNodeId: null,
|
||||
connectionTargetHandeId: null,
|
||||
});
|
||||
|
||||
onConnectStart?.(event, { nodeId, handleId, handleType });
|
||||
@@ -139,6 +141,8 @@ export function handlePointerDown({
|
||||
)
|
||||
: connectionPosition,
|
||||
connectionStatus: getConnectionStatus(!!prevClosestHandle, isValid),
|
||||
connectionTargetNodeId: connection.target,
|
||||
connectionTargetHandleId: connection.targetHandle,
|
||||
});
|
||||
|
||||
if (!prevClosestHandle && !isValid && !handleDomNode) {
|
||||
|
||||
@@ -275,6 +275,8 @@ const createRFStore = () =>
|
||||
connectionHandleId: initialState.connectionHandleId,
|
||||
connectionHandleType: initialState.connectionHandleType,
|
||||
connectionStatus: initialState.connectionStatus,
|
||||
connectionTargetNodeId: initialState.connectionTargetNodeId,
|
||||
connectionTargetHandleId: initialState.connectionTargetHandleId,
|
||||
}),
|
||||
reset: () => set({ ...initialState }),
|
||||
}));
|
||||
|
||||
@@ -31,6 +31,8 @@ const initialState: ReactFlowStore = {
|
||||
connectionNodeId: null,
|
||||
connectionHandleId: null,
|
||||
connectionHandleType: 'source',
|
||||
connectionTargetNodeId: null,
|
||||
connectionTargetHandleId: null,
|
||||
connectionPosition: { x: 0, y: 0 },
|
||||
connectionStatus: null,
|
||||
connectionMode: ConnectionMode.Strict,
|
||||
|
||||
@@ -169,6 +169,8 @@ export type ReactFlowStore = {
|
||||
|
||||
connectionNodeId: string | null;
|
||||
connectionHandleId: string | null;
|
||||
connectionTargetNodeId: string | null;
|
||||
connectionTargetHandleId: string | null;
|
||||
connectionHandleType: HandleType | null;
|
||||
connectionPosition: XYPosition;
|
||||
connectionStatus: ConnectionStatus | null;
|
||||
@@ -284,4 +286,4 @@ export type OnError = (id: string, message: string) => void;
|
||||
|
||||
export interface UpdateEdgeOptions {
|
||||
shouldReplaceId?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user