From 8a74944929e9ed2cf1bc37d58bbc5a31a6681c9f Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Wed, 21 Aug 2024 11:29:15 -0300 Subject: [PATCH] Fix auto login hooks order bug --- src/frontend/src/hooks/flows/use-autosave-flow.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/hooks/flows/use-autosave-flow.ts b/src/frontend/src/hooks/flows/use-autosave-flow.ts index ddf32b927a7..01bff30eb7d 100644 --- a/src/frontend/src/hooks/flows/use-autosave-flow.ts +++ b/src/frontend/src/hooks/flows/use-autosave-flow.ts @@ -8,11 +8,11 @@ const useAutoSaveFlow = () => { const saveFlow = useSaveFlow(); const autoSaving = useFlowsManagerStore((state) => state.autoSaving); - const autoSaveFlow = autoSaving - ? useDebounce((flow?: FlowType) => { - saveFlow(flow); - }, SAVE_DEBOUNCE_TIME) - : () => {}; + const autoSaveFlow = useDebounce((flow?: FlowType) => { + if (autoSaving) { + saveFlow(flow); + } + }, SAVE_DEBOUNCE_TIME); return autoSaveFlow; };