fix: set the current list when opening a task

This commit is contained in:
kolaente 2021-10-17 15:16:26 +02:00
parent cc32ca244c
commit 1c8e26bdc6
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 10 additions and 7 deletions

View file

@ -63,6 +63,12 @@ export const store = createStore({
state.online = !!import.meta.env.VITE_IS_ONLINE || online state.online = !!import.meta.env.VITE_IS_ONLINE || online
}, },
[CURRENT_LIST](state, currentList) { [CURRENT_LIST](state, currentList) {
// Server updates don't return the right. Therefore the right is reset after updating the list which is
// confusing because all the buttons will disappear in that case. To prevent this, we're keeping the right
// when updating the list in global state.
if (typeof state.currentList.maxRight !== 'undefined' && (typeof currentList.maxRight === 'undefined' || currentList.maxRight === null)) {
currentList.maxRight = state.currentList.maxRight
}
state.currentList = currentList state.currentList = currentList
}, },
[HAS_TASKS](state, hasTasks) { [HAS_TASKS](state, hasTasks) {
@ -135,12 +141,6 @@ export const store = createStore({
commit(BACKGROUND, null) commit(BACKGROUND, null)
} }
// Server updates don't return the right. Therefore the right is reset after updating the list which is
// confusing because all the buttons will disappear in that case. To prevent this, we're keeping the right
// when updating the list in global state.
if (typeof state.currentList.maxRight !== 'undefined' && (typeof currentList.maxRight === 'undefined' || currentList.maxRight === null)) {
currentList.maxRight = state.currentList.maxRight
}
commit(CURRENT_LIST, currentList) commit(CURRENT_LIST, currentList)
}, },
}, },

View file

@ -510,7 +510,10 @@ export default {
}, },
parent: { parent: {
handler(parent) { handler(parent) {
this.$store.commit(CURRENT_LIST, parent !== null ? parent.list : this.currentList) const parentList = parent !== null ? parent.list : null
if (parentList !== null) {
this.$store.commit(CURRENT_LIST, parentList)
}
}, },
immediate: true, immediate: true,
}, },