feat: modify router logic, can not create workspace by router query

This commit is contained in:
QiShaoXuan
2022-12-23 19:04:42 +08:00
parent aa58bbcd1b
commit c58dd6f403
5 changed files with 78 additions and 18 deletions
@@ -3,14 +3,11 @@ import { WorkSpaceSliderBar } from '@/components/workspace-slider-bar';
import { useRouter } from 'next/router';
import { StyledPage, StyledWrapper } from './styles';
import { PropsWithChildren } from 'react';
import { useAppState } from '@/providers/app-state-provider';
import { useInitWorkspace } from '@/hooks/use-init-workspace';
import useEnsureWorkspace from '@/hooks/use-ensure-workspace';
export const WorkspaceDefender = ({ children }: PropsWithChildren) => {
const { synced } = useAppState();
const { loading } = useInitWorkspace(!synced);
return <>{!loading ? children : null}</>;
const { workspaceLoaded } = useEnsureWorkspace();
return <>{workspaceLoaded ? children : null}</>;
};
export const WorkspaceLayout = ({ children }: PropsWithChildren) => {