Fix trying to load kanban buckets if the kanban board is not in focus
This commit is contained in:
parent
0d94386e99
commit
a4bc95902a
2 changed files with 17 additions and 0 deletions
|
@ -247,10 +247,22 @@
|
||||||
},
|
},
|
||||||
computed: mapState({
|
computed: mapState({
|
||||||
buckets: state => state.kanban.buckets,
|
buckets: state => state.kanban.buckets,
|
||||||
|
loadedListId: state => state.kanban.listId,
|
||||||
loading: LOADING,
|
loading: LOADING,
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
loadBuckets() {
|
loadBuckets() {
|
||||||
|
|
||||||
|
// Prevent trying to load buckets if the task popup view is active
|
||||||
|
if(this.$route.name !== 'list.kanban') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only load buckets if we don't already loaded them
|
||||||
|
if(this.loadedListId === this.$route.params.listId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.$store.dispatch('kanban/loadBucketsForList', this.$route.params.listId)
|
this.$store.dispatch('kanban/loadBucketsForList', this.$route.params.listId)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
|
|
|
@ -12,8 +12,12 @@ export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: () => ({
|
state: () => ({
|
||||||
buckets: [],
|
buckets: [],
|
||||||
|
listId: 0,
|
||||||
}),
|
}),
|
||||||
mutations: {
|
mutations: {
|
||||||
|
setListId(state, listId) {
|
||||||
|
state.listId = listId
|
||||||
|
},
|
||||||
setBuckets(state, buckets) {
|
setBuckets(state, buckets) {
|
||||||
state.buckets = buckets
|
state.buckets = buckets
|
||||||
},
|
},
|
||||||
|
@ -119,6 +123,7 @@ export default {
|
||||||
return bucketService.getAll({listId: listId})
|
return bucketService.getAll({listId: listId})
|
||||||
.then(r => {
|
.then(r => {
|
||||||
ctx.commit('setBuckets', r)
|
ctx.commit('setBuckets', r)
|
||||||
|
ctx.commit('setListId', listId)
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue