perf: 在PageContent上增加ErrorBoundary

pull/81/head
moonrailgun 3 years ago
parent a7cacb57e5
commit d55533d4c4

@ -4,6 +4,7 @@ import _isNil from 'lodash/isNil';
import { useDrag } from 'react-use-gesture'; import { useDrag } from 'react-use-gesture';
import { useIsMobile } from '@/hooks/useIsMobile'; import { useIsMobile } from '@/hooks/useIsMobile';
import clsx from 'clsx'; import clsx from 'clsx';
import { ErrorBoundary } from '@/components/ErrorBoundary';
const PageContentRoot: React.FC = (props) => ( const PageContentRoot: React.FC = (props) => (
<div className="flex flex-row flex-1 overflow-hidden">{props.children}</div> <div className="flex flex-row flex-1 overflow-hidden">{props.children}</div>
@ -87,7 +88,7 @@ export const PageContent: React.FC<PageContentProps> = React.memo((props) => {
const contentEl = children; const contentEl = children;
const el = ( const el = (
<> <ErrorBoundary>
{sidebarEl} {sidebarEl}
<div <div
@ -108,7 +109,7 @@ export const PageContent: React.FC<PageContentProps> = React.memo((props) => {
{contentEl} {contentEl}
</div> </div>
</div> </div>
</> </ErrorBoundary>
); );
if (isMobile) { if (isMobile) {

Loading…
Cancel
Save