diff --git a/src/frontend/src/pages/AppWrapperPage/index.tsx b/src/frontend/src/pages/AppWrapperPage/index.tsx
index 595ccbd19..65c16df8d 100644
--- a/src/frontend/src/pages/AppWrapperPage/index.tsx
+++ b/src/frontend/src/pages/AppWrapperPage/index.tsx
@@ -10,7 +10,6 @@ import {
TIMEOUT_ERROR_MESSAGE,
} from "@/constants/constants";
import { useGetHealthQuery } from "@/controllers/API/queries/health";
-import useTrackLastVisitedPath from "@/hooks/use-track-last-visited-path";
import useFlowsManagerStore from "@/stores/flowsManagerStore";
import { useUtilityStore } from "@/stores/utilityStore";
import { cn } from "@/utils/utils";
@@ -20,8 +19,6 @@ import { ErrorBoundary } from "react-error-boundary";
import { Outlet } from "react-router-dom";
export function AppWrapperPage() {
- useTrackLastVisitedPath();
-
const isLoading = useFlowsManagerStore((state) => state.isLoading);
const healthCheckMaxRetries = useFlowsManagerStore(
diff --git a/src/frontend/src/pages/DashboardWrapperPage/index.tsx b/src/frontend/src/pages/DashboardWrapperPage/index.tsx
new file mode 100644
index 000000000..991537cdc
--- /dev/null
+++ b/src/frontend/src/pages/DashboardWrapperPage/index.tsx
@@ -0,0 +1,11 @@
+import Header from "@/components/headerComponent";
+import { Outlet } from "react-router-dom";
+
+export function DashboardWrapperPage() {
+ return (
+
+
+
+
+ );
+}
diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
index 61060f933..0e18a67ab 100644
--- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
+++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
@@ -143,7 +143,7 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
};
}, [lastCopiedSelection, lastSelection, takeSnapshot, selectionMenuVisible]);
- const { isFetching, refetch } = useGetBuildsQuery({});
+ const { isFetching } = useGetBuildsQuery({ flowId: currentFlowId });
const showCanvas =
Object.keys(templates).length > 0 &&
@@ -151,8 +151,6 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
!isFetching;
useEffect(() => {
- refetch();
- useFlowStore.setState({ autoSaveFlow });
if (checkOldComponents({ nodes })) {
setNoticeData({
title:
@@ -161,6 +159,10 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
}
}, [currentFlowId]);
+ useEffect(() => {
+ useFlowStore.setState({ autoSaveFlow });
+ });
+
function handleUndo(e: KeyboardEvent) {
if (!isWrappedWithClass(e, "noflow")) {
e.preventDefault();
diff --git a/src/frontend/src/pages/FlowPage/index.tsx b/src/frontend/src/pages/FlowPage/index.tsx
index 420ea9501..0321d9e11 100644
--- a/src/frontend/src/pages/FlowPage/index.tsx
+++ b/src/frontend/src/pages/FlowPage/index.tsx
@@ -8,7 +8,6 @@ import { customStringify } from "@/utils/reactflowUtils";
import { useEffect } from "react";
import { useBlocker, useNavigate, useParams } from "react-router-dom";
import FlowToolbar from "../../components/chatComponent";
-import Header from "../../components/headerComponent";
import { useDarkStore } from "../../stores/darkStore";
import useFlowStore from "../../stores/flowStore";
import useFlowsManagerStore from "../../stores/flowsManagerStore";
@@ -81,7 +80,7 @@ export default function FlowPage({ view }: { view?: boolean }): JSX.Element {
}
};
awaitgetTypes();
- }, [id, flows]);
+ }, [id, flows, currentFlowId]);
useEffect(() => {
setOnFlowPage(true);
@@ -94,7 +93,6 @@ export default function FlowPage({ view }: { view?: boolean }): JSX.Element {
return (
<>
-
{currentFlow && (
diff --git a/src/frontend/src/pages/Playground/index.tsx b/src/frontend/src/pages/Playground/index.tsx
index 47c2aa177..09b4ae8c3 100644
--- a/src/frontend/src/pages/Playground/index.tsx
+++ b/src/frontend/src/pages/Playground/index.tsx
@@ -1,6 +1,9 @@
+import { useGetRefreshFlows } from "@/controllers/API/queries/flows/use-get-refresh-flows";
+import { useGetGlobalVariables } from "@/controllers/API/queries/variables";
import { useStoreStore } from "@/stores/storeStore";
+import { useTypesStore } from "@/stores/typesStore";
import { useEffect } from "react";
-import { useParams } from "react-router-dom";
+import { useNavigate, useParams } from "react-router-dom";
import LoadingComponent from "../../components/loadingComponent";
import { getComponent } from "../../controllers/API";
import IOModal from "../../modals/IOModal";
@@ -8,7 +11,6 @@ import useFlowsManagerStore from "../../stores/flowsManagerStore";
import cloneFLowWithParent from "../../utils/storeUtils";
export default function PlaygroundPage() {
- const getFlowById = useFlowsManagerStore((state) => state.getFlowById);
const flows = useFlowsManagerStore((state) => state.flows);
const setCurrentFlow = useFlowsManagerStore((state) => state.setCurrentFlow);
const currentSavedFlow = useFlowsManagerStore((state) => state.currentFlow);
@@ -21,19 +23,38 @@ export default function PlaygroundPage() {
return newFlow;
}
+ const navigate = useNavigate();
+ useGetGlobalVariables();
+
+ const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
+ const { mutateAsync: refreshFlows } = useGetRefreshFlows();
+ const setIsLoading = useFlowsManagerStore((state) => state.setIsLoading);
+ const getTypes = useTypesStore((state) => state.getTypes);
+
// Set flow tab id
useEffect(() => {
- if (flows) {
- const flow = getFlowById(id!);
- if (flow) {
- setCurrentFlow(flow);
- } else {
- if (validApiKey)
- getFlowData().then((flow) => {
- setCurrentFlow(flow);
- });
+ const awaitgetTypes = async () => {
+ if (flows && currentFlowId === "") {
+ const isAnExistingFlow = flows.find((flow) => flow.id === id);
+
+ if (!isAnExistingFlow) {
+ if (validApiKey) {
+ getFlowData().then((flow) => {
+ setCurrentFlow(flow);
+ });
+ } else {
+ navigate("/");
+ }
+ }
+ setCurrentFlow(isAnExistingFlow);
+ } else if (!flows) {
+ setIsLoading(true);
+ await refreshFlows(undefined);
+ await getTypes();
+ setIsLoading(false);
}
- }
+ };
+ awaitgetTypes();
}, [id, flows, validApiKey]);
return (
diff --git a/src/frontend/src/pages/ViewPage/index.tsx b/src/frontend/src/pages/ViewPage/index.tsx
index 1e7ad5b67..5c9de515a 100644
--- a/src/frontend/src/pages/ViewPage/index.tsx
+++ b/src/frontend/src/pages/ViewPage/index.tsx
@@ -1,6 +1,5 @@
import { useGetRefreshFlows } from "@/controllers/API/queries/flows/use-get-refresh-flows";
import { useGetGlobalVariables } from "@/controllers/API/queries/variables";
-import useFlowStore from "@/stores/flowStore";
import { useTypesStore } from "@/stores/typesStore";
import { useEffect } from "react";
import { useNavigate, useParams } from "react-router-dom";
@@ -10,7 +9,6 @@ import Page from "../FlowPage/components/PageComponent";
export default function ViewPage() {
const setCurrentFlow = useFlowsManagerStore((state) => state.setCurrentFlow);
- const setOnFlowPage = useFlowStore((state) => state.setOnFlowPage);
const { id } = useParams();
const navigate = useNavigate();
useGetGlobalVariables();
@@ -43,15 +41,6 @@ export default function ViewPage() {
awaitgetTypes();
}, [id, flows]);
- useEffect(() => {
- setOnFlowPage(true);
-
- return () => {
- setOnFlowPage(false);
- setCurrentFlow(undefined);
- };
- }, [id]);
-
return (
diff --git a/src/frontend/src/routes.tsx b/src/frontend/src/routes.tsx
index 6807bfdf2..8626998c9 100644
--- a/src/frontend/src/routes.tsx
+++ b/src/frontend/src/routes.tsx
@@ -1,17 +1,18 @@
-import React, { lazy } from "react";
+import { lazy } from "react";
import {
createBrowserRouter,
createRoutesFromElements,
Navigate,
+ Outlet,
Route,
} from "react-router-dom";
import { ProtectedAdminRoute } from "./components/authAdminGuard";
import { ProtectedRoute } from "./components/authGuard";
import { ProtectedLoginRoute } from "./components/authLoginGuard";
import { AuthSettingsGuard } from "./components/authSettingsGuard";
-import { CatchAllRoute } from "./components/catchAllRoutes";
import { StoreGuard } from "./components/storeGuard";
import { AppWrapperPage } from "./pages/AppWrapperPage";
+import { DashboardWrapperPage } from "./pages/DashboardWrapperPage";
import FlowPage from "./pages/FlowPage";
import LoginPage from "./pages/LoginPage";
import MyCollectionComponent from "./pages/MainPage/components/myCollectionComponent";
@@ -34,132 +35,104 @@ const PlaygroundPage = lazy(() => import("./pages/Playground"));
const SignUp = lazy(() => import("./pages/SignUpPage"));
const router = createBrowserRouter(
createRoutesFromElements([
-
}>
+
}>
-
+
}
>
- } />
- }
- >
+ }>
+ }>
+ } />
+ }
+ >
+ }
+ />
+
+
+ }
+ >
+
+ }
+ />
+
+
}
+ >
+
}
+ />
+
+
+
}>
+
} />
+
} />
+
} />
+
+
+
+ }
+ />
+ } />
+ } />
+
}
- />
-
-
}
- >
-
+
+
+
+ }
+ />
+
+
+
+ }
+ />
+
+ }>
+
+
+
+
}
/>
-
}
- >
-
}
- />
+
+ }>
+ } />
+ } />
+
+
} />
+
+
+ } />
-
-
-
- }
- >
- } />
- } />
- } />
-
-
-
- }
- />
- } />
- } />
-
-
-
-
-
-
- }
- />
-
-
-
-
-
- }
- />
-
-
-
-
- }
- />
-
-
-
-
-
- }
- />
-
-
-
- }
- />
-
-
-
- }
- />
-
-
-
-
- }
- />
}
/>
-
-
-
- }
- />
-
-
-
-
- }
- >
-
+ } />
,
]),
);
diff --git a/src/frontend/tests/scheduled-end-to-end/generalBugs-shard-1.spec.ts b/src/frontend/tests/scheduled-end-to-end/generalBugs-shard-1.spec.ts
index cec5acbac..83923b65e 100644
--- a/src/frontend/tests/scheduled-end-to-end/generalBugs-shard-1.spec.ts
+++ b/src/frontend/tests/scheduled-end-to-end/generalBugs-shard-1.spec.ts
@@ -1,4 +1,4 @@
-import { expect, test } from "@playwright/test";
+import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
@@ -70,6 +70,8 @@ test("should delete rows from table message", async ({ page }) => {
timeout: 30000,
});
+ await page.waitForTimeout(2000);
+
await page.getByTestId("user-profile-settings").last().click();
await page.getByText("Settings").last().click();
await page.getByText("Messages").last().click();