Add server-side hydration of initial config+status. Closes #1964
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable react/no-danger */
|
||||
/* eslint-disable react/no-unescaped-entities */
|
||||
import { Layout } from 'antd';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import Head from 'next/head';
|
||||
@@ -27,6 +29,11 @@ export const Main: FC = () => {
|
||||
setupNoLinkReferrer(layoutRef.current);
|
||||
}, []);
|
||||
|
||||
const hydrationScript = `
|
||||
window.statusHydration = {{.StatusJSON}};
|
||||
window.configHydration = {{.ServerConfigJSON}};
|
||||
`;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
@@ -86,6 +93,7 @@ export const Main: FC = () => {
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
|
||||
<style>{customStyles}</style>
|
||||
<script dangerouslySetInnerHTML={{ __html: hydrationScript }} />
|
||||
</Head>
|
||||
|
||||
<ClientConfigStore />
|
||||
|
||||
Reference in New Issue
Block a user