From d3b4c64554593faacd52cc585a64c1f8a1c1b4eb Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 28 Mar 2020 14:08:57 -0400 Subject: [PATCH] fix: save timeout failsafe --- client/components/editor.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/components/editor.vue b/client/components/editor.vue index 1062a77c..764bcabf 100644 --- a/client/components/editor.vue +++ b/client/components/editor.vue @@ -232,6 +232,11 @@ export default { async save({ rethrow = false, overwrite = false } = {}) { this.showProgressDialog('saving') this.isSaving = true + + const saveTimeoutHandle = setTimeout(() => { + throw new Error('Save operation timed out.') + }, 30000) + try { if (this.$store.get('editor/mode') === 'create') { // -------------------------------------------- @@ -338,9 +343,13 @@ export default { icon: 'warning' }) if (rethrow === true) { + clearTimeout(saveTimeoutHandle) + this.isSaving = false + this.hideProgressDialog() throw err } } + clearTimeout(saveTimeoutHandle) this.isSaving = false this.hideProgressDialog() },