mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-30 00:29:46 +08:00
feat: add loading in middle page
This commit is contained in:
@@ -4,10 +4,11 @@ import { useRouter } from 'next/router';
|
||||
import { StyledPage, StyledWrapper } from './styles';
|
||||
import { PropsWithChildren } from 'react';
|
||||
import useEnsureWorkspace from '@/hooks/use-ensure-workspace';
|
||||
import { PageLoading } from '@/components/loading';
|
||||
|
||||
export const WorkspaceDefender = ({ children }: PropsWithChildren) => {
|
||||
const { workspaceLoaded } = useEnsureWorkspace();
|
||||
return <>{workspaceLoaded ? children : null}</>;
|
||||
return <>{workspaceLoaded ? children : <PageLoading />}</>;
|
||||
};
|
||||
|
||||
export const WorkspaceLayout = ({ children }: PropsWithChildren) => {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useAppState } from '@/providers/app-state-provider/context';
|
||||
import useEnsureWorkspace from '@/hooks/use-ensure-workspace';
|
||||
import { PageLoading } from '@/components/loading';
|
||||
|
||||
const WorkspaceIndex = () => {
|
||||
const router = useRouter();
|
||||
@@ -31,7 +32,7 @@ const WorkspaceIndex = () => {
|
||||
workspaceLoaded,
|
||||
]);
|
||||
|
||||
return <></>;
|
||||
return <PageLoading />;
|
||||
};
|
||||
|
||||
export default WorkspaceIndex;
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useAppState } from '@/providers/app-state-provider';
|
||||
import useEnsureWorkspace from '@/hooks/use-ensure-workspace';
|
||||
import { PageLoading } from '@/components/loading';
|
||||
|
||||
export const WorkspaceIndex = () => {
|
||||
const router = useRouter();
|
||||
@@ -14,7 +15,7 @@ export const WorkspaceIndex = () => {
|
||||
}
|
||||
}, [currentWorkspaceId, router, workspaceLoaded]);
|
||||
|
||||
return <></>;
|
||||
return <PageLoading />;
|
||||
};
|
||||
|
||||
export default WorkspaceIndex;
|
||||
|
||||
Reference in New Issue
Block a user