Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: make 404 route faster

tzhangchi4fed0de502e1
diff --git a/packages/app/src/pages/_app.tsx b/packages/app/src/pages/_app.tsx
index b881f9c07b..5f1c9499d3 100644
--- a/packages/app/src/pages/_app.tsx
+++ b/packages/app/src/pages/_app.tsx
@@ -67,8 +67,8 @@ const App = ({ Component, pageProps }: AppPropsWithLayout) => {
};
const AppDefender = ({ children }: PropsWithChildren) => {
- const { synced } = useAppState();
const router = useRouter();
+ const { synced } = useAppState();
useEffect(() => {
if (router.asPath === '/') {
@@ -76,6 +76,11 @@ const AppDefender = ({ children }: PropsWithChildren) => {
}
}, [router]);
+ // if you visit /404, you will see the children directly
+ if (router.route === '/404') {
+ return <div>{children}</div>;
+ }
+
return <div>{synced ? children : <PageLoading />}</div>;
};