Merge pull request #1206 from lowdefy/fix-dev-server-react-hooks

fix(server-dev): Fix react hooks used incorrectly.
This commit is contained in:
Gerrie van Wyk 2022-05-23 22:19:48 +02:00 committed by GitHub
commit 9569df4e98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,11 +24,11 @@ import usePageConfig from './utils/usePageConfig.js';
const Page = ({ Components, config, pageId, resetContext, router, types }) => {
const { data: session, status } = useSession();
const { data: pageConfig } = usePageConfig(pageId, router.basePath);
if (status === 'loading') {
return '';
}
const { data: pageConfig } = usePageConfig(pageId, router.basePath);
if (!pageConfig) {
router.replace(`/404`);
return '';