From fd425b9ff0a30628cbbf7f2a3c6c4a0ac237a3d4 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Fri, 22 Oct 2021 17:07:04 +1100 Subject: [PATCH] Update reload screen copy (#530) --- src/components/ErrorBoundary.tsx | 58 +++++++++++++++++++------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx index f3e60c26..4b73a467 100644 --- a/src/components/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary.tsx @@ -1,11 +1,13 @@ -import React from "react"; +import { Component } from "react"; import EmptyState, { IEmptyStateProps } from "./EmptyState"; import { Button } from "@mui/material"; import ReloadIcon from "@mui/icons-material/Refresh"; import InlineOpenInNewIcon from "components/InlineOpenInNewIcon"; -import meta from "../../package.json"; -class ErrorBoundary extends React.Component< + +import meta from "@root/package.json"; + +class ErrorBoundary extends Component< IEmptyStateProps & { render?: (errorMessage: string) => React.ReactNode } > { state = { hasError: false, errorMessage: "" }; @@ -25,13 +27,14 @@ class ErrorBoundary extends React.Component< if (this.state.hasError) { if (this.props.render) return this.props.render(this.state.errorMessage); - return ( - - {this.state.errorMessage} - {this.state.errorMessage.startsWith("Loading chunk") ? ( + if (this.state.errorMessage.startsWith("Loading chunk")) + return ( + + Reload this page to get the latest update - ) : ( - - )} + + } + fullScreen + /> + ); + + return ( + + {this.state.errorMessage} + } fullScreen