Refactor paste function in flowStore.ts
This commit is contained in:
parent
b455284e97
commit
c7ca7bf209
1 changed files with 10 additions and 3 deletions
|
|
@ -219,8 +219,16 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
paste: (selection, position) => {
|
paste: (selection, position) => {
|
||||||
if(selection.nodes.some((node) => node.data.type === "ChatInput") && checkChatInput(get().nodes)){
|
if (
|
||||||
useAlertStore.getState().setErrorData({title: "Error pasting components", list: ["You can only have one ChatInput component in the flow"]});
|
selection.nodes.some((node) => node.data.type === "ChatInput") &&
|
||||||
|
checkChatInput(get().nodes)
|
||||||
|
) {
|
||||||
|
useAlertStore
|
||||||
|
.getState()
|
||||||
|
.setErrorData({
|
||||||
|
title: "Error pasting components",
|
||||||
|
list: ["You can only have one ChatInput component in the flow"],
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let minimumX = Infinity;
|
let minimumX = Infinity;
|
||||||
|
|
@ -491,7 +499,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
updateVerticesBuild: (
|
updateVerticesBuild: (
|
||||||
vertices: {
|
vertices: {
|
||||||
verticesIds: string[];
|
verticesIds: string[];
|
||||||
verticesOrder: string[][];
|
|
||||||
verticesLayers: string[][];
|
verticesLayers: string[][];
|
||||||
runId: string;
|
runId: string;
|
||||||
} | null
|
} | null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue