Skip to content

Commit

Permalink
fix: ensure navigation only occurs when currentSavedFlow data is present
Browse files Browse the repository at this point in the history
  • Loading branch information
anovazzi1 committed Feb 6, 2025
1 parent 3a6f824 commit 1d5380c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/frontend/src/pages/Playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit 1d5380c

Please sign in to comment.