From 8daef8ebcec7f68cbbace88c04f72797a87a2b55 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 17 Feb 2020 11:29:58 -0800 Subject: [PATCH] fix: Reload app if error loading editor chunk --- app/components/InputRich.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/components/InputRich.js b/app/components/InputRich.js index 9022a709e..7649ff1ef 100644 --- a/app/components/InputRich.js +++ b/app/components/InputRich.js @@ -30,8 +30,17 @@ class InputRich extends React.Component { }; 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() {