Fix vertices being executed when sending message
This commit is contained in:
parent
04bbf4eaf0
commit
0c6d40d207
1 changed files with 2 additions and 19 deletions
|
|
@ -50,36 +50,19 @@ export default function IOView({ children, open, setOpen }): JSX.Element {
|
||||||
const [chatValue, setChatValue] = useState("");
|
const [chatValue, setChatValue] = useState("");
|
||||||
const isBuilding = useFlowStore((state) => state.isBuilding);
|
const isBuilding = useFlowStore((state) => state.isBuilding);
|
||||||
const currentFlow = useFlowsManagerStore((state) => state.currentFlow);
|
const currentFlow = useFlowsManagerStore((state) => state.currentFlow);
|
||||||
const verticesBuild = useFlowStore((state) => state.verticesBuild);
|
|
||||||
const updateVerticesBuild = useFlowStore(
|
|
||||||
(state) => state.updateVerticesBuild
|
|
||||||
);
|
|
||||||
|
|
||||||
async function updateVertices() {
|
async function updateVertices() {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return updateVerticesOrder(currentFlow!.id, null);
|
||||||
if (!verticesBuild) {
|
|
||||||
updateVerticesOrder(currentFlow!.id, null).then((orderResponse) => {
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
updateVertices();
|
|
||||||
}, [currentFlow]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) {
|
if (open) {
|
||||||
updateVerticesBuild(null);
|
|
||||||
updateVertices();
|
updateVertices();
|
||||||
}
|
}
|
||||||
}, [open]);
|
}, [open, currentFlow]);
|
||||||
|
|
||||||
async function sendMessage(count = 1): Promise<void> {
|
async function sendMessage(count = 1): Promise<void> {
|
||||||
if (isBuilding) return;
|
if (isBuilding) return;
|
||||||
await updateVertices();
|
|
||||||
setIsBuilding(true);
|
setIsBuilding(true);
|
||||||
setLockChat(true);
|
setLockChat(true);
|
||||||
setChatValue("");
|
setChatValue("");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue