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) => {
|
||||
if(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"]});
|
||||
if (
|
||||
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;
|
||||
}
|
||||
let minimumX = Infinity;
|
||||
|
|
@ -491,7 +499,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
updateVerticesBuild: (
|
||||
vertices: {
|
||||
verticesIds: string[];
|
||||
verticesOrder: string[][];
|
||||
verticesLayers: string[][];
|
||||
runId: string;
|
||||
} | null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue