/** @jsxRuntime classic */ /** @jsx jsx */ import { Component, type ReactNode } from 'react' import { Button } from '@keystone-ui/button' import { jsx, Box, Center, Stack, useTheme } from '@keystone-ui/core' import { AlertTriangleIcon } from '@keystone-ui/icons/icons/AlertTriangleIcon' type ErrorBoundaryProps = { children: ReactNode } type ErrorBoundaryState = { error?: any hasError: boolean isReloading: boolean } export class ErrorBoundary extends Component { state: ErrorBoundaryState = { hasError: false, isReloading: false } static getDerivedStateFromError (error: any) { return { error, hasError: true } } reloadPage = () => { this.setState({ isReloading: true }) window.location.reload() } render () { if (this.state.hasError) { return (
Something went wrong.
) } return this.props.children } } type ErrorContainerProps = { children: ReactNode } export const ErrorContainer = ({ children }: ErrorContainerProps) => { const { colors, shadow } = useTheme() return (
{children}
) }