diff --git a/packages/desktop-client/src/components/reports/CategorySelector.tsx b/packages/desktop-client/src/components/reports/CategorySelector.tsx
index 8dc2da84dab..d8ecbba27d9 100644
--- a/packages/desktop-client/src/components/reports/CategorySelector.tsx
+++ b/packages/desktop-client/src/components/reports/CategorySelector.tsx
@@ -53,117 +53,124 @@ export default function CategorySelector({
}}
>
{categoryGroups &&
- categoryGroups.map(categoryGroup => {
- const allCategoriesInGroupSelected = categoryGroup.categories.every(
- category =>
- selectedCategories.some(
- selectedCategory => selectedCategory.id === category.id,
- ),
- );
- const noCategorySelected = categoryGroup.categories.every(
- category =>
- !selectedCategories.some(
- selectedCategory => selectedCategory.id === category.id,
- ),
- );
- return (
-
-
- {
- const selectedCategoriesExcludingGroupCategories =
- selectedCategories.filter(
- selectedCategory =>
- !categoryGroup.categories.some(
- groupCategory =>
- groupCategory.id === selectedCategory.id,
- ),
- );
- if (allCategoriesInGroupSelected) {
- setSelectedCategories(
- selectedCategoriesExcludingGroupCategories,
- );
- } else {
- setSelectedCategories(
- selectedCategoriesExcludingGroupCategories.concat(
- categoryGroup.categories,
- ),
- );
- }
- }}
- />
-
-
-
- !categoryGroup.hidden)
+ .map(categoryGroup => {
+ const visibleCategories = categoryGroup.categories.filter(
+ category => !category.hidden,
+ );
+
+ const allCategoriesInGroupSelected = visibleCategories.every(
+ category =>
+ selectedCategories.some(
+ selectedCategory => selectedCategory.id === category.id,
+ ),
+ );
+ const noCategorySelected = visibleCategories.every(
+ category =>
+ !selectedCategories.some(
+ selectedCategory => selectedCategory.id === category.id,
+ ),
+ );
+ return (
+
+ -
- {categoryGroup.categories.map((category, index) => {
- const isChecked = selectedCategories.some(
- selectedCategory => selectedCategory.id === category.id,
- );
- return (
-
-
- {
- if (isChecked) {
- setSelectedCategories(
- selectedCategories.filter(
- selectedCategory =>
- selectedCategory.id !== category.id,
- ),
- );
- } else {
- setSelectedCategories([
- ...selectedCategories,
- category,
- ]);
- }
+ {
+ const selectedCategoriesExcludingGroupCategories =
+ selectedCategories.filter(
+ selectedCategory =>
+ !visibleCategories.some(
+ groupCategory =>
+ groupCategory.id === selectedCategory.id,
+ ),
+ );
+ if (allCategoriesInGroupSelected) {
+ setSelectedCategories(
+ selectedCategoriesExcludingGroupCategories,
+ );
+ } else {
+ setSelectedCategories(
+ selectedCategoriesExcludingGroupCategories.concat(
+ visibleCategories,
+ ),
+ );
+ }
+ }}
+ />
+
+
+ -
+
+ {visibleCategories.map((category, index) => {
+ const isChecked = selectedCategories.some(
+ selectedCategory =>
+ selectedCategory.id === category.id,
+ );
+ return (
+
-
-
- );
- })}
-
-
-
- );
- })}
+ {
+ if (isChecked) {
+ setSelectedCategories(
+ selectedCategories.filter(
+ selectedCategory =>
+ selectedCategory.id !== category.id,
+ ),
+ );
+ } else {
+ setSelectedCategories([
+ ...selectedCategories,
+ category,
+ ]);
+ }
+ }}
+ />
+
+
+ );
+ })}
+
+
+
+ );
+ })}
>
);
diff --git a/upcoming-release-notes/1696.md b/upcoming-release-notes/1696.md
new file mode 100644
index 00000000000..517290c0854
--- /dev/null
+++ b/upcoming-release-notes/1696.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [kyrias]
+---
+
+Hide hidden groups and categories from spending report category selector.