aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2022-03-27 12:21:33 +0300
committerHenry Jameson <me@hjkos.com>2022-03-27 12:21:33 +0300
commit9ac7046521d9cffcff1e2d846b1158d32c01ed85 (patch)
treeacc2fdeb91fa250915d696071ab615255792dcef
parente4c804fac07a0cc73ae91c06ad4c183f02190cd9 (diff)
Fix notices not disappearing on their own
-rw-r--r--src/modules/interface.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/modules/interface.js b/src/modules/interface.js
index 6509386a..17277331 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -106,7 +106,7 @@ const interfaceMod = {
commit('openSettingsModal')
},
pushGlobalNotice (
- { commit, dispatch },
+ { commit, dispatch, state },
{
messageKey,
messageArgs = {},
@@ -118,11 +118,14 @@ const interfaceMod = {
messageArgs,
level
}
+ commit('pushGlobalNotice', notice)
+ // Adding a new element to array wraps it in a Proxy, which breaks the comparison
+ // TODO: Generate UUID or something instead or relying on !== operator?
+ const newNotice = state.globalNotices[state.globalNotices.length - 1]
if (timeout) {
- setTimeout(() => dispatch('removeGlobalNotice', notice), timeout)
+ setTimeout(() => dispatch('removeGlobalNotice', newNotice), timeout)
}
- commit('pushGlobalNotice', notice)
- return notice
+ return newNotice
},
removeGlobalNotice ({ commit }, notice) {
commit('removeGlobalNotice', notice)