From c723924388b9b9d27ee2055c2ac8828d96d6b810 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 8 Jan 2024 16:22:18 -0300 Subject: [PATCH] removed unused location store context --- src/frontend/src/App.tsx | 6 +---- .../components/PageComponent/index.tsx | 11 --------- src/frontend/src/stores/locationStore.tsx | 15 ------------ .../src/types/zustand/location/index.ts | 24 ------------------- 4 files changed, 1 insertion(+), 55 deletions(-) diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index 5e54edae1..44f5261bd 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -26,15 +26,11 @@ import { useTypesStore } from "./stores/typesStore"; export default function App() { const setCurrent = useLocationStore((state) => state.setCurrent); - const setShowSideBar = useLocationStore((state) => state.setShowSideBar); - const setIsStackedOpen = useLocationStore((state) => state.setIsStackedOpen); let location = useLocation(); useEffect(() => { setCurrent(location.pathname.replace(/\/$/g, "").split("/")); - setShowSideBar(true); - setIsStackedOpen(true); - }, [location.pathname, setCurrent, setIsStackedOpen, setShowSideBar]); + }, [location.pathname, setCurrent]); const errorData = useAlertStore((state) => state.errorData); const errorOpen = useAlertStore((state) => state.errorOpen); diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 82f6b9457..7adf33c09 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -155,12 +155,6 @@ export default function Page({ const [selectionMenuVisible, setSelectionMenuVisible] = useState(false); - const setExtraComponent = useLocationStore( - (state) => state.setExtraComponent - ); - const setExtraNavigation = useLocationStore( - (state) => state.setExtraNavigation - ); const setErrorData = useAlertStore((state) => state.setErrorData); const edgeUpdateSuccessful = useRef(true); @@ -304,11 +298,6 @@ export default function Page({ [getNodeId, setNodes, takeSnapshot, paste] ); - useEffect(() => { - setExtraComponent(); - setExtraNavigation({ title: "Components" }); - }, []); - const onEdgeUpdateStart = useCallback(() => { edgeUpdateSuccessful.current = false; }, []); diff --git a/src/frontend/src/stores/locationStore.tsx b/src/frontend/src/stores/locationStore.tsx index 74445d3f3..630bbeefa 100644 --- a/src/frontend/src/stores/locationStore.tsx +++ b/src/frontend/src/stores/locationStore.tsx @@ -10,19 +10,4 @@ export const useLocationStore = create((set, get) => ({ setCurrent: (newState) => { set({ current: newState }); }, - setIsStackedOpen: (newState) => { - set({ isStackedOpen: newState }); - }, - showSideBar: window.location.pathname.split("/")[1] ? true : false, - setShowSideBar: (newState) => { - set({ showSideBar: newState }); - }, - extraNavigation: { title: "" }, - setExtraNavigation: (newState) => { - set({ extraNavigation: newState }); - }, - extraComponent: <>, - setExtraComponent: (newState) => { - set({ extraComponent: newState }); - }, })); diff --git a/src/frontend/src/types/zustand/location/index.ts b/src/frontend/src/types/zustand/location/index.ts index 2d2d44766..5b6e690a7 100644 --- a/src/frontend/src/types/zustand/location/index.ts +++ b/src/frontend/src/types/zustand/location/index.ts @@ -1,28 +1,4 @@ export type LocationStoreType = { current: Array; setCurrent: (newState: Array) => void; - isStackedOpen: boolean; - setIsStackedOpen: (newState: boolean) => void; - showSideBar: boolean; - setShowSideBar: (newState: boolean) => void; - extraNavigation: { - title: string; - options?: Array<{ - name: string; - href: string; - icon: React.ElementType; - children?: Array; - }>; - }; - setExtraNavigation: (newState: { - title: string; - options?: Array<{ - name: string; - href: string; - icon: React.ElementType; - children?: Array; - }>; - }) => void; - extraComponent: any; - setExtraComponent: (newState: JSX.Element) => void; };