mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-28 22:18:44 +02:00
feat(theme-mermaid): upgrade Mermaid to v10.4 - handle async rendering (#9305)
This commit is contained in:
parent
dc7ae426ac
commit
58be496da2
11 changed files with 327 additions and 86 deletions
|
@ -107,5 +107,6 @@ export {
|
|||
export {
|
||||
ErrorBoundaryTryAgainButton,
|
||||
ErrorBoundaryError,
|
||||
ErrorBoundaryErrorMessageFallback,
|
||||
ErrorCauseBoundary,
|
||||
} from './utils/errorBoundaryUtils';
|
||||
|
|
|
@ -9,3 +9,8 @@
|
|||
white-space: pre-wrap;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.errorBoundaryFallback {
|
||||
color: red;
|
||||
padding: 0.55rem;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import React, {type ComponentProps} from 'react';
|
||||
import Translate from '@docusaurus/Translate';
|
||||
import {getErrorCausalChain} from '@docusaurus/utils-common';
|
||||
import type {Props as ErrorProps} from '@theme/Error';
|
||||
import styles from './errorBoundaryUtils.module.css';
|
||||
|
||||
export function ErrorBoundaryTryAgainButton(
|
||||
|
@ -23,6 +24,20 @@ export function ErrorBoundaryTryAgainButton(
|
|||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
// A very simple reusable ErrorBoundary fallback component
|
||||
export function ErrorBoundaryErrorMessageFallback({
|
||||
error,
|
||||
tryAgain,
|
||||
}: ErrorProps): JSX.Element {
|
||||
return (
|
||||
<div className={styles.errorBoundaryFallback}>
|
||||
<p>{error.message}</p>
|
||||
<ErrorBoundaryTryAgainButton onClick={tryAgain} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ErrorBoundaryError({error}: {error: Error}): JSX.Element {
|
||||
const causalChain = getErrorCausalChain(error);
|
||||
const fullMessage = causalChain.map((e) => e.message).join('\n\nCause:\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue