fix: Reload app if error loading editor chunk

This commit is contained in:
Tom Moor
2020-02-17 11:29:58 -08:00
parent 760e2b2ce9
commit 8daef8ebce

View File

@ -30,8 +30,17 @@ class InputRich extends React.Component<Props> {
};
loadEditor = async () => {
const EditorImport = await import('./Editor');
this.editorComponent = EditorImport.default;
try {
const EditorImport = await import('./Editor');
this.editorComponent = EditorImport.default;
} catch (err) {
console.error(err);
// 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();
}
};
render() {