mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
Add error boundary to DesktopContent. For #2811
This commit is contained in:
parent
7cb5773a97
commit
cd0f92f496
@ -1,10 +1,12 @@
|
|||||||
import React, { ComponentType, FC } from 'react';
|
import React, { ComponentType, FC } from 'react';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import { TabsProps } from 'antd';
|
import { TabsProps } from 'antd';
|
||||||
|
import { ErrorBoundary } from 'react-error-boundary';
|
||||||
import { SocialLink } from '../../../interfaces/social-link.model';
|
import { SocialLink } from '../../../interfaces/social-link.model';
|
||||||
import styles from './Content.module.scss';
|
import styles from './Content.module.scss';
|
||||||
import { CustomPageContent } from '../CustomPageContent/CustomPageContent';
|
import { CustomPageContent } from '../CustomPageContent/CustomPageContent';
|
||||||
import { ContentHeader } from '../../common/ContentHeader/ContentHeader';
|
import { ContentHeader } from '../../common/ContentHeader/ContentHeader';
|
||||||
|
import { ComponentError } from '../ComponentError/ComponentError';
|
||||||
|
|
||||||
export type DesktopContentProps = {
|
export type DesktopContentProps = {
|
||||||
name: string;
|
name: string;
|
||||||
@ -58,7 +60,16 @@ export const DesktopContent: FC<DesktopContentProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<ErrorBoundary
|
||||||
|
// eslint-disable-next-line react/no-unstable-nested-components
|
||||||
|
fallbackRender={({ error, resetErrorBoundary }) => (
|
||||||
|
<ComponentError
|
||||||
|
componentName="DesktopContent"
|
||||||
|
message={error.message}
|
||||||
|
retryFunction={resetErrorBoundary}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
>
|
||||||
<div className={styles.lowerHalf} id="skip-to-content">
|
<div className={styles.lowerHalf} id="skip-to-content">
|
||||||
<ContentHeader
|
<ContentHeader
|
||||||
name={name}
|
name={name}
|
||||||
@ -76,6 +87,6 @@ export const DesktopContent: FC<DesktopContentProps> = ({
|
|||||||
!!extraPageContent && aboutTabContent
|
!!extraPageContent && aboutTabContent
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user