From 1d5380c8f50c0c8c82011d636edfdce3db25a881 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 6 Feb 2025 11:28:53 -0300 Subject: [PATCH] fix: ensure navigation only occurs when currentSavedFlow data is present --- src/frontend/src/pages/Playground/index.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/pages/Playground/index.tsx b/src/frontend/src/pages/Playground/index.tsx index 59b688c39e31..90ad8c436de5 100644 --- a/src/frontend/src/pages/Playground/index.tsx +++ b/src/frontend/src/pages/Playground/index.tsx @@ -68,12 +68,14 @@ export default function PlaygroundPage() { useEffect(() => { document.title = currentSavedFlow?.name || "Langflow"; - const { inputs, outputs } = getInputsAndOutputs( - currentSavedFlow?.data?.nodes || [], - ); - if (inputs.length === 0 && outputs.length === 0) { - // redirect to the home page - navigate("/"); + if (currentSavedFlow?.data) { + const { inputs, outputs } = getInputsAndOutputs( + currentSavedFlow?.data?.nodes || [], + ); + if (inputs.length === 0 && outputs.length === 0) { + // redirect to the home page + navigate("/"); + } } }, [currentSavedFlow]);