fix: Failed editor chunk load should refresh page
This commit is contained in:
@@ -151,9 +151,17 @@ class DocumentScene extends React.Component<Props> {
|
|||||||
loadEditor = async () => {
|
loadEditor = async () => {
|
||||||
if (this.editorComponent) return;
|
if (this.editorComponent) return;
|
||||||
|
|
||||||
const Imported = await import('./Editor');
|
try {
|
||||||
EditorImport = Imported.default;
|
const EditorImport = await import('./Editor');
|
||||||
this.editorComponent = EditorImport;
|
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();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleCloseMoveModal = () => (this.moveModalOpen = false);
|
handleCloseMoveModal = () => (this.moveModalOpen = false);
|
||||||
|
|||||||
Reference in New Issue
Block a user