fix: abort connection on error preventing infinite build (#6050)
* fix: abort connection on build errors * fix: streamline error message formatting in ErrorMessage class * test: remove timeout from waitForSelector in generalBugs-shard-10.spec.ts --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
d676aef9b4
commit
d24e989a91
6 changed files with 643 additions and 32 deletions
|
|
@ -119,6 +119,11 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
false,
|
||||
);
|
||||
set({ isBuilding: false });
|
||||
get().revertBuiltStatusFromBuilding();
|
||||
get().setLockChat(false);
|
||||
useAlertStore.getState().setErrorData({
|
||||
title: "Build stopped",
|
||||
});
|
||||
},
|
||||
isPending: true,
|
||||
setHasIO: (hasIO) => {
|
||||
|
|
@ -757,14 +762,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
get().setLockChat(false);
|
||||
},
|
||||
onBuildUpdate: handleBuildUpdate,
|
||||
onBuildStopped: () => {
|
||||
get().setIsBuilding(false);
|
||||
setErrorData({
|
||||
title: "Build stopped",
|
||||
});
|
||||
get().revertBuiltStatusFromBuilding();
|
||||
get().setLockChat(false);
|
||||
},
|
||||
onBuildError: (title: string, list: string[], elementList) => {
|
||||
const idList =
|
||||
(elementList
|
||||
|
|
@ -783,6 +780,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
setErrorData({ list, title });
|
||||
get().setIsBuilding(false);
|
||||
get().setLockChat(false);
|
||||
get().buildController.abort();
|
||||
},
|
||||
onBuildStart: (elementList) => {
|
||||
const idList = elementList
|
||||
|
|
|
|||
|
|
@ -199,7 +199,8 @@ export async function buildFlowVertices({
|
|||
onBuildStart(ids.map((id) => ({ id: id, reference: id })));
|
||||
ids.forEach((id) => verticesStartTimeMs.set(id, Date.now()));
|
||||
};
|
||||
|
||||
console.log("type", type);
|
||||
console.log("data", data);
|
||||
switch (type) {
|
||||
case "vertices_sorted": {
|
||||
const verticesToRun = data.to_run;
|
||||
|
|
@ -319,7 +320,7 @@ export async function buildFlowVertices({
|
|||
case "error": {
|
||||
if (data?.category === "error") {
|
||||
useMessagesStore.getState().addMessage(data);
|
||||
if (data?.properties?.source?.id === null) {
|
||||
if (!data?.properties?.source?.id) {
|
||||
onBuildError!("Error Building Flow", [data.text]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ test(
|
|||
|
||||
await page.getByTestId("button_run_chat output").click();
|
||||
|
||||
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
||||
await page.waitForSelector("text=built successfully");
|
||||
|
||||
await page.getByTestId("playground-btn-flow-io").click();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue