From 6fe38c9ccb5fba1758c2ee4f436fd93be95dd215 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 11 Mar 2024 19:25:26 +0000 Subject: [PATCH 1/3] Cast to string --- tests/perf-test/SelectionList.perf-test.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/perf-test/SelectionList.perf-test.tsx b/tests/perf-test/SelectionList.perf-test.tsx index 63b6185351cb..c2e3e4383c45 100644 --- a/tests/perf-test/SelectionList.perf-test.tsx +++ b/tests/perf-test/SelectionList.perf-test.tsx @@ -80,13 +80,13 @@ function SelectionListWrapper({canSelectMultiple}: SelectionListWrapperProps) { const onSelectRow = (item: ListItem) => { if (canSelectMultiple) { - if (selectedIds.includes(item.keyForList)) { + if (selectedIds.includes(item.keyForList as string)) { setSelectedIds(selectedIds.filter((selectedId) => selectedId === item.keyForList)); } else { - setSelectedIds([...selectedIds, item.keyForList]); + setSelectedIds([...selectedIds, (item.keyForList as string)]); } } else { - setSelectedIds([item.keyForList]); + setSelectedIds([(item.keyForList as string)]); } }; From dd1441639253c8654d16923d5623f9cc3878edd7 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 11 Mar 2024 19:47:28 +0000 Subject: [PATCH 2/3] Apply suggestion --- tests/perf-test/SelectionList.perf-test.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/perf-test/SelectionList.perf-test.tsx b/tests/perf-test/SelectionList.perf-test.tsx index c2e3e4383c45..2a9791ec714d 100644 --- a/tests/perf-test/SelectionList.perf-test.tsx +++ b/tests/perf-test/SelectionList.perf-test.tsx @@ -79,14 +79,18 @@ function SelectionListWrapper({canSelectMultiple}: SelectionListWrapperProps) { ]; const onSelectRow = (item: ListItem) => { + if (!item.keyForList) { + return; + } + if (canSelectMultiple) { - if (selectedIds.includes(item.keyForList as string)) { + if (selectedIds.includes(item.keyForList)) { setSelectedIds(selectedIds.filter((selectedId) => selectedId === item.keyForList)); } else { - setSelectedIds([...selectedIds, (item.keyForList as string)]); + setSelectedIds([...selectedIds, item.keyForList]); } } else { - setSelectedIds([(item.keyForList as string)]); + setSelectedIds([item.keyForList]); } }; From 07801ddda5a8988327cd75448a8f29c044c35d8d Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 11 Mar 2024 19:56:41 +0000 Subject: [PATCH 3/3] run prettier --- tests/perf-test/SelectionList.perf-test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/perf-test/SelectionList.perf-test.tsx b/tests/perf-test/SelectionList.perf-test.tsx index 2a9791ec714d..ceb54abb5117 100644 --- a/tests/perf-test/SelectionList.perf-test.tsx +++ b/tests/perf-test/SelectionList.perf-test.tsx @@ -81,7 +81,7 @@ function SelectionListWrapper({canSelectMultiple}: SelectionListWrapperProps) { const onSelectRow = (item: ListItem) => { if (!item.keyForList) { return; - } + } if (canSelectMultiple) { if (selectedIds.includes(item.keyForList)) {