fix: Prevent reload loop with error on editor load
This commit is contained in:
parent
e9ce80a3aa
commit
0cac5cfe51
|
@ -8,6 +8,7 @@ import CenteredContent from "components/CenteredContent";
|
|||
import HelpText from "components/HelpText";
|
||||
import PageTitle from "components/PageTitle";
|
||||
import { githubIssuesUrl } from "../../shared/utils/routeHelpers";
|
||||
import env from "env";
|
||||
|
||||
type Props = {
|
||||
children: React.Node,
|
||||
|
@ -41,7 +42,7 @@ class ErrorBoundary extends React.Component<Props> {
|
|||
|
||||
render() {
|
||||
if (this.error) {
|
||||
const isReported = !!window.Sentry;
|
||||
const isReported = !!window.Sentry && env.DEPLOYMENT === "hosted";
|
||||
|
||||
return (
|
||||
<CenteredContent>
|
||||
|
|
|
@ -203,12 +203,15 @@ class DocumentScene extends React.Component<Props> {
|
|||
const EditorImport = await import("./Editor");
|
||||
this.editorComponent = EditorImport.default;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
if (err.message && err.message.match(/chunk/)) {
|
||||
// If the editor bundle fails to load then reload the entire window. This
|
||||
// can happen if a deploy happens between the user loading the initial JS
|
||||
// bundle and the async-loaded editor JS bundle as the hash will change.
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the editor bundle fails to load then reload the entire window. This
|
||||
// can happen if a deploy happens between the user loading the initial JS
|
||||
// bundle and the async-loaded editor JS bundle as the hash will change.
|
||||
window.location.reload();
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Reference in New Issue