live updates for boards
Signed-off-by: chandi Langecker <git@chandi.it>
This commit is contained in:
committed by
Julius Härtl
parent
9674c344ea
commit
322ee92573
@@ -52,6 +52,18 @@ hasPush = listen('deck_board_update', (name, body) => {
|
||||
store.dispatch('refreshBoard', currentBoardId)
|
||||
})
|
||||
|
||||
listen('deck_card_update', (name, body) => {
|
||||
|
||||
// ignore update events which we have triggered ourselves
|
||||
if (isOurSessionToken(body._causingSessionToken)) return
|
||||
|
||||
// only handle update events for the currently open board
|
||||
const currentBoardId = store.state.currentBoard?.id
|
||||
if (body.boardId !== currentBoardId) return
|
||||
|
||||
store.dispatch('loadStacks', currentBoardId)
|
||||
})
|
||||
|
||||
/**
|
||||
* is the notify_push app active and can
|
||||
* provide us with real time updates?
|
||||
|
||||
@@ -333,10 +333,15 @@ export default new Vuex.Store({
|
||||
commit('setAssignableUsers', board.users)
|
||||
},
|
||||
|
||||
async refreshBoard({ commit }, boardId) {
|
||||
async refreshBoard({ commit, dispatch }, boardId) {
|
||||
const board = await apiClient.loadById(boardId)
|
||||
const etagHasChanged = board.ETag !== this.state.currentBoard.ETag
|
||||
commit('setCurrentBoard', board)
|
||||
commit('setAssignableUsers', board.users)
|
||||
|
||||
if (etagHasChanged) {
|
||||
dispatch('loadStacks', boardId)
|
||||
}
|
||||
},
|
||||
|
||||
toggleShowArchived({ commit }) {
|
||||
|
||||
Reference in New Issue
Block a user