Kaynağa Gözat

fix: save timeout failsafe

NGPixel 5 yıl önce
ebeveyn
işleme
d3b4c64554
1 değiştirilmiş dosya ile 9 ekleme ve 0 silme
  1. 9 0
      client/components/editor.vue

+ 9 - 0
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()
     },