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:
Archer
2024-09-26 16:27:28 +08:00
committed by GitHub
parent e6bad93b32
commit 54e0a0eab1
23 changed files with 153 additions and 114 deletions

View File

@@ -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>