diff --git a/agenta-web/src/components/Layout/Layout.tsx b/agenta-web/src/components/Layout/Layout.tsx index 29691ee915..ac8c491e42 100644 --- a/agenta-web/src/components/Layout/Layout.tsx +++ b/agenta-web/src/components/Layout/Layout.tsx @@ -17,6 +17,7 @@ import {ThemeProvider} from "react-jss" import {JSSTheme, StyleProps as MainStyleProps} from "@/lib/Types" import {Lightning} from "@phosphor-icons/react" import packageJsonData from "../../../package.json" +import {useProjectData} from "@/contexts/project.context" const {Content, Footer} = Layout const {Text} = Typography @@ -85,6 +86,7 @@ const App: React.FC = ({children}) => { const {appTheme} = useAppTheme() const {currentApp} = useAppsData() const [footerRef, {height: footerHeight}] = useElementSize() + const {isProjectId} = useProjectData() const classes = useStyles({themeMode: appTheme, footerHeight} as StyleProps) const router = useRouter() const appId = router.query.app_id as string @@ -161,12 +163,14 @@ const App: React.FC = ({children}) => { // wait unitl we have the app id, if its an app route if (isAppRoute && (!appId || !currentApp)) return null + const isAuthRoute = + router.pathname.includes("/auth") || router.pathname.includes("/post-signup") + return ( {typeof window === "undefined" ? null : ( - {router.pathname.includes("/auth") || - router.pathname.includes("/post-signup") ? ( + {isAuthRoute || !isProjectId ? ( {children} @@ -174,6 +178,7 @@ const App: React.FC = ({children}) => { ) : ( + // !isAuthRoute && isProjectId diff --git a/agenta-web/src/contexts/project.context.tsx b/agenta-web/src/contexts/project.context.tsx index c3278fae18..a527320d20 100644 --- a/agenta-web/src/contexts/project.context.tsx +++ b/agenta-web/src/contexts/project.context.tsx @@ -44,7 +44,7 @@ export const getCurrentProject = () => projectContextValues const ProjectContextProvider: React.FC = ({children}) => { const [project, setProject] = useStateCallback(null) const [useOrgData, setUseOrgData] = useState(() => () => "") - const [isLoading, setIsLoading] = useState(false) + const [isLoading, setIsLoading] = useState(true) const {doesSessionExist} = useSession() useEffect(() => { @@ -57,7 +57,7 @@ const ProjectContextProvider: React.FC = ({children}) => { const workspaceId: string = selectedOrg?.default_workspace.id || DEFAULT_UUID - const isProjectId = !isLoading && Boolean(project?.project_id) + const isProjectId = !isLoading && !!project?.project_id const projectId = (project?.project_id as string) || DEFAULT_UUID const fetcher = async (onSuccess?: () => void) => { @@ -103,7 +103,7 @@ const ProjectContextProvider: React.FC = ({children}) => { refetch: fetcher, }} > - {children} + {isProjectId ? children : null} ) }