From 55ee8b4c4977485f8f698aa17d2908ee48abf232 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 21 Mar 2025 13:35:24 -0300 Subject: [PATCH] fix: add validation on build request to prevent output glitch (#7210) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 (use-post-logout.ts): import Cookies from "react-cookie" to handle cookies in the logout functionality 💡 (use-post-logout.ts): update logic to check for "auto_login_lf" cookie value in addition to autoLogin state before logging out the user * 📝 (use-post-logout.ts): add constants for IS_AUTO_LOGIN and LANGFLOW_AUTO_LOGIN_OPTION for better code readability and maintainability * 🐛 (use-get-builds-polling-mutation.ts): fix potential issue where flowPool is undefined before setting it to state --- .../API/queries/_builds/use-get-builds-polling-mutation.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/controllers/API/queries/_builds/use-get-builds-polling-mutation.ts b/src/frontend/src/controllers/API/queries/_builds/use-get-builds-polling-mutation.ts index 0e6e4c992..88b42f5ae 100644 --- a/src/frontend/src/controllers/API/queries/_builds/use-get-builds-polling-mutation.ts +++ b/src/frontend/src/controllers/API/queries/_builds/use-get-builds-polling-mutation.ts @@ -99,7 +99,7 @@ export const useGetBuildsMutation: useMutationFunctionType< const getBuildsFn = async ( payload: IGetBuilds, - ): Promise<{ vertex_builds: FlowPoolType }> => { + ): Promise<{ vertex_builds: FlowPoolType } | undefined> => { if (requestInProgressRef.current[payload.flowId]) { return Promise.reject("Request already in progress"); } @@ -112,7 +112,10 @@ export const useGetBuildsMutation: useMutationFunctionType< if (currentFlow) { const flowPool = res?.data?.vertex_builds; - setFlowPool(flowPool); + if (Object.keys(flowPool).length > 0) { + setFlowPool(flowPool); + } + return; } return res.data;