chore(store): add current connection result closes #2916

This commit is contained in:
moklick
2023-03-20 17:33:15 +01:00
parent 5bcf586694
commit 0f2eee7706
9 changed files with 69 additions and 3 deletions
@@ -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) {
+2
View File
@@ -275,6 +275,8 @@ const createRFStore = () =>
connectionHandleId: initialState.connectionHandleId,
connectionHandleType: initialState.connectionHandleType,
connectionStatus: initialState.connectionStatus,
connectionTargetNodeId: initialState.connectionTargetNodeId,
connectionTargetHandleId: initialState.connectionTargetHandleId,
}),
reset: () => set({ ...initialState }),
}));
+2
View File
@@ -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,
+3 -1
View File
@@ -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;
}
}