From 48719f16cedfec50dda8bd1280000fd45b511b4c Mon Sep 17 00:00:00 2001 From: Chen-I Lim Date: Tue, 27 Oct 2020 12:08:12 -0700 Subject: [PATCH] Handle missing option id when grouping cards --- webapp/src/viewModel/boardTree.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/webapp/src/viewModel/boardTree.ts b/webapp/src/viewModel/boardTree.ts index a39b7b5ab..5e59c4454 100644 --- a/webapp/src/viewModel/boardTree.ts +++ b/webapp/src/viewModel/boardTree.ts @@ -189,12 +189,16 @@ class MutableBoardTree implements BoardTree { for (const optionId of optionIds) { if (optionId) { const option = groupByProperty.options.find(o => o.id === optionId) - const cards = this.cards.filter((o) => optionId === o.properties[groupByProperty.id]) - const group: Group = { - option, - cards + if (option) { + const cards = this.cards.filter((o) => optionId === o.properties[groupByProperty.id]) + const group: Group = { + option, + cards + } + groups.push(group) + } else { + Utils.logError(`groupCardsByOptions: Missing option with id: ${optionId}`) } - groups.push(group) } else { // Empty group const emptyGroupCards = this.cards.filter((o) => {