import React from 'react'; import ResetButtons from './reset-buttons' import {EventGroup} from 'shared/components/workbench/events' import DefaultErrorView from './view'; const ErrorView = (props) => { if (props.children) return props.children const inspectChildrenProps = { type: 'error', events: [props.error], units: props.gist?.units } const inspectChildren = () return (props.children || (

If you think your last action caused this error, you can:

)) } class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error) { // Update state so the next render will show the fallback UI. return { hasError: true, error }; } componentDidCatch(error, errorInfo) { // You can also log the error to an error reporting service console.log(error, errorInfo); } componentDidUpdate(prevProps) { if (this.props.gist !== prevProps.gist) { this.setState({hasError: false}) } } render() { if (this.state.hasError) { // You can render any custom fallback UI return {this.errorView} } try { return this.props.children; } catch(e) { return {this.errorView}; } } } export default ErrorBoundary