Spaces:
Running
Running
File size: 796 Bytes
b694417 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import { Component, type ReactNode } from "react";
interface GraphErrorBoundaryProps {
children: ReactNode;
}
interface GraphErrorBoundaryState {
hasError: boolean;
}
export class GraphErrorBoundary extends Component<
GraphErrorBoundaryProps,
GraphErrorBoundaryState
> {
public state: GraphErrorBoundaryState = { hasError: false };
public static getDerivedStateFromError(): GraphErrorBoundaryState {
return { hasError: true };
}
public render(): ReactNode {
if (this.state.hasError) {
return (
<section className="graph-empty" role="alert">
The interactive graph could not be rendered. Your extraction remains
available; try another result or reload the page.
</section>
);
}
return this.props.children;
}
}
|