From c00902cb6b8dd115090850f931eeb5b57ee942be Mon Sep 17 00:00:00 2001 From: Chen-I Lim Date: Fri, 6 Nov 2020 14:07:04 -0800 Subject: [PATCH] Filter relevant updates --- webapp/src/viewModel/boardTree.ts | 6 +++++- webapp/src/viewModel/cardTree.ts | 6 +++++- webapp/src/viewModel/workspaceTree.ts | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/webapp/src/viewModel/boardTree.ts b/webapp/src/viewModel/boardTree.ts index 141820115..bd9a17ada 100644 --- a/webapp/src/viewModel/boardTree.ts +++ b/webapp/src/viewModel/boardTree.ts @@ -59,7 +59,11 @@ class MutableBoardTree implements BoardTree { } 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)) } diff --git a/webapp/src/viewModel/cardTree.ts b/webapp/src/viewModel/cardTree.ts index 98490fc85..8c8252f46 100644 --- a/webapp/src/viewModel/cardTree.ts +++ b/webapp/src/viewModel/cardTree.ts @@ -30,7 +30,11 @@ class MutableCardTree implements CardTree { } 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)) } diff --git a/webapp/src/viewModel/workspaceTree.ts b/webapp/src/viewModel/workspaceTree.ts index c348a8393..1ab4be484 100644 --- a/webapp/src/viewModel/workspaceTree.ts +++ b/webapp/src/viewModel/workspaceTree.ts @@ -27,6 +27,10 @@ class MutableWorkspaceTree { } 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.rebuild(OctoUtils.hydrateBlocks(this.rawBlocks)) }