1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-24 08:22:29 +02:00

Filter relevant updates

This commit is contained in:
Chen-I Lim 2020-11-06 14:07:04 -08:00
parent 0cca55126c
commit c00902cb6b
3 changed files with 14 additions and 2 deletions

View File

@ -59,7 +59,11 @@ class MutableBoardTree implements BoardTree {
} }
incrementalUpdate(updatedBlocks: IBlock[]) { incrementalUpdate(updatedBlocks: IBlock[]) {
this.rawBlocks = OctoUtils.mergeBlocks(this.rawBlocks, updatedBlocks) const relevantBlocks = updatedBlocks.filter((block) => block.id === this.boardId || block.parentId === this.boardId)
if (relevantBlocks.length < 1) {
return
}
this.rawBlocks = OctoUtils.mergeBlocks(this.rawBlocks, relevantBlocks)
this.rebuild(OctoUtils.hydrateBlocks(this.rawBlocks)) this.rebuild(OctoUtils.hydrateBlocks(this.rawBlocks))
} }

View File

@ -30,7 +30,11 @@ class MutableCardTree implements CardTree {
} }
incrementalUpdate(updatedBlocks: IBlock[]) { incrementalUpdate(updatedBlocks: IBlock[]) {
this.rawBlocks = OctoUtils.mergeBlocks(this.rawBlocks, updatedBlocks) const relevantBlocks = updatedBlocks.filter((block) => block.id === this.cardId || block.parentId === this.cardId)
if (relevantBlocks.length < 1) {
return
}
this.rawBlocks = OctoUtils.mergeBlocks(this.rawBlocks, relevantBlocks)
this.rebuild(OctoUtils.hydrateBlocks(this.rawBlocks)) this.rebuild(OctoUtils.hydrateBlocks(this.rawBlocks))
} }

View File

@ -27,6 +27,10 @@ class MutableWorkspaceTree {
} }
incrementalUpdate(updatedBlocks: IBlock[]) { incrementalUpdate(updatedBlocks: IBlock[]) {
const relevantBlocks = updatedBlocks.filter((block) => block.type === 'board' || block.type === 'view')
if (relevantBlocks.length < 1) {
return
}
this.rawBlocks = OctoUtils.mergeBlocks(this.rawBlocks, updatedBlocks) this.rawBlocks = OctoUtils.mergeBlocks(this.rawBlocks, updatedBlocks)
this.rebuild(OctoUtils.hydrateBlocks(this.rawBlocks)) this.rebuild(OctoUtils.hydrateBlocks(this.rawBlocks))
} }