4.8.11 code perf (#2804)
* perf: support child layout * perf: user form ui * perf: plugin tool output code * perf: code * perf: node fold hook
This commit is contained in:
@@ -11,9 +11,17 @@ import { useInitApp } from '@/web/context/useInitApp';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import '@/web/styles/reset.scss';
|
||||
import NextHead from '@/components/common/NextHead';
|
||||
import { useEffect } from 'react';
|
||||
import { ReactElement, useEffect } from 'react';
|
||||
import { NextPage } from 'next';
|
||||
|
||||
function App({ Component, pageProps }: AppProps) {
|
||||
type NextPageWithLayout = NextPage & {
|
||||
setLayout?: (page: ReactElement) => JSX.Element;
|
||||
};
|
||||
type AppPropsWithLayout = AppProps & {
|
||||
Component: NextPageWithLayout;
|
||||
};
|
||||
|
||||
function App({ Component, pageProps }: AppPropsWithLayout) {
|
||||
const { feConfigs, scripts, title } = useInitApp();
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -30,6 +38,8 @@ function App({ Component, pageProps }: AppProps) {
|
||||
);
|
||||
}, []);
|
||||
|
||||
const setLayout = Component.setLayout || ((page) => <>{page}</>);
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextHead
|
||||
@@ -46,9 +56,7 @@ function App({ Component, pageProps }: AppProps) {
|
||||
<QueryClientContext>
|
||||
<I18nContextProvider>
|
||||
<ChakraUIContext>
|
||||
<Layout>
|
||||
<Component {...pageProps} />
|
||||
</Layout>
|
||||
<Layout>{setLayout(<Component {...pageProps} />)}</Layout>
|
||||
</ChakraUIContext>
|
||||
</I18nContextProvider>
|
||||
</QueryClientContext>
|
||||
|
||||
Reference in New Issue
Block a user