fix(editor): Fix canvas loading when page gets restored from bfcache (#6304)

* fix(editor): Fix canvas loading when page gets restored from bfcache

* Lint fix
This commit is contained in:
OlegIvaniv 2023-05-23 15:39:54 +02:00 committed by GitHub
parent e3a53fd19d
commit 11477f0a20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3777,6 +3777,12 @@ export default defineComponent({
this.disableNodes([node]);
}
},
onPageShow(e: PageTransitionEvent) {
// Page was restored from the bfcache (back-forward cache)
if (e.persisted) {
this.stopLoading();
}
},
},
async mounted() {
this.resetWorkspace();
@ -3880,6 +3886,7 @@ export default defineComponent({
document.addEventListener('keydown', this.keyDown);
document.addEventListener('keyup', this.keyUp);
window.addEventListener('message', this.onPostMessageReceived);
window.addEventListener('pageshow', this.onPageShow);
this.$root.$on('newWorkflow', this.newWorkflow);
this.$root.$on('importWorkflowData', this.onImportWorkflowDataEvent);
@ -3904,6 +3911,7 @@ export default defineComponent({
document.removeEventListener('keyup', this.keyUp);
window.removeEventListener('message', this.onPostMessageReceived);
window.removeEventListener('beforeunload', this.onBeforeUnload);
window.removeEventListener('pageshow', this.onPageShow);
this.$root.$off('newWorkflow', this.newWorkflow);
this.$root.$off('importWorkflowData', this.onImportWorkflowDataEvent);