From 71c38ffa1487c169df66c31b984f18925da33f86 Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 6 Feb 2024 23:44:30 +0700 Subject: [PATCH] fix: cannot unselect disabled category --- src/libs/OptionsListUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index b6518b361381..03a18538155b 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -973,7 +973,7 @@ function getCategoryListSections( } const selectedOptionNames = selectedOptions.map((selectedOption) => selectedOption.name); - const enabledAndSelectedCategories = sortedCategories.filter((category) => category.enabled || selectedOptionNames.includes(category.name)); + const enabledAndSelectedCategories = [...selectedOptions, ...sortedCategories.filter((category) => category.enabled && !selectedOptionNames.includes(category.name))]; const numberOfVisibleCategories = enabledAndSelectedCategories.length; if (numberOfVisibleCategories < CONST.CATEGORY_LIST_THRESHOLD) {