From 0252e9b4b7b93eeac944301d45587a52a5758868 Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 30 Jan 2020 19:57:22 +0900 Subject: [PATCH] Fix duplicated disconnected dialog (Fix #5782) (#5790) * Fix #5782 fix duplicated disconnected dialog * fix --- src/client/app.vue | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/client/app.vue b/src/client/app.vue index a0265951c1..eef6daad20 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -167,6 +167,7 @@ export default Vue.extend({ widgetsEditMode: false, enableWidgets: window.innerWidth >= 1100, canBack: false, + disconnectedDialog: null as Promise | null, faChevronLeft, faComments, faHashtag, faBroadcastTower, faFireAlt, faEllipsisH, faPencilAlt, faBars, faTimes, faBell, faSearch, faUserCog, faCog, faUser, faHome, faStar, faCircle, faAt, faEnvelope, faListUl, faPlus, faUserClock, faLaugh, faUsers, faTachometerAlt, faExchangeAlt, faGlobe, faChartBar, faCloud, faServer }; }, @@ -217,15 +218,19 @@ export default Vue.extend({ } } - this.$root.stream.on('_disconnected_', async () => { - const confirm = await this.$root.dialog({ - type: 'warning', - showCancelButton: true, - title: this.$t('disconnectedFromServer'), - text: this.$t('reloadConfirm'), - }); - if (!confirm.canceled) { - location.reload(); + this.$root.stream.on('_disconnected_', () => { + if (!this.disconnectedDialog) { + this.disconnectedDialog = this.$root.dialog({ + type: 'warning', + showCancelButton: true, + title: this.$t('disconnectedFromServer'), + text: this.$t('reloadConfirm'), + }).then(({ canceled }) => { + if (!canceled) { + location.reload(); + } + this.disconnectedDialog = null; + }); } });