Skip to content

Commit

Permalink
fix(UI): notifications timeout anomalies
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Nov 24, 2021
1 parent fe84355 commit cc99491
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/common/customizations/postgresql.js
Expand Up @@ -13,6 +13,7 @@ module.exports = {
// Tools
processesList: true,
// Structure
schemas: true,
tables: true,
views: true,
triggers: true,
Expand Down
21 changes: 11 additions & 10 deletions src/renderer/components/TheNotificationsBoard.vue
Expand Up @@ -40,15 +40,13 @@ export default {
}
},
watch: {
notifications: {
deep: true,
handler: function (notification) {
if (notification.length) {
this.timeouts[notification[0].uid] = setTimeout(() => {
this.removeNotification(notification[0].uid);
delete this.timeouts[notification.uid];
}, this.notificationsTimeout * 1000);
}
'notifications.length': function (val) {
if (val > 0) {
const nUid = this.notifications[0].uid;
this.timeouts[nUid] = setTimeout(() => {
this.removeNotification(nUid);
delete this.timeouts[nUid];
}, this.notificationsTimeout * 1000);
}
}
},
Expand All @@ -63,11 +61,14 @@ export default {
}
},
rearmTimeouts () {
const delay = 50;
let i = this.notifications.length * delay;
for (const notification of this.notifications) {
this.timeouts[notification.uid] = setTimeout(() => {
this.removeNotification(notification.uid);
delete this.timeouts[notification.uid];
}, this.notificationsTimeout * 1000);
}, (this.notificationsTimeout * 1000) + i);
i = i > delay ? i - delay : 0;
}
}
}
Expand Down

0 comments on commit cc99491

Please sign in to comment.