Skip to content

Commit

Permalink
Merge pull request Expensify#38495 from Expensify/cmartins-fixCategor…
Browse files Browse the repository at this point in the history
…iesCrash

Fix crash on Categories page
  • Loading branch information
MonilBhavsar authored Mar 19, 2024
2 parents 22bd9eb + 8af0109 commit 34fa987
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/workspace/categories/WorkspaceCategoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function WorkspaceCategoriesPage({policy, policyCategories, route}: WorkspaceCat
const enabledCategories = selectedCategoriesArray.filter((categoryName) => policyCategories?.[categoryName]?.enabled);
if (enabledCategories.length > 0) {
const categoriesToDisable = selectedCategoriesArray
.filter((categoryName) => policyCategories?.[categoryName].enabled)
.filter((categoryName) => policyCategories?.[categoryName]?.enabled)
.reduce<Record<string, {name: string; enabled: boolean}>>((acc, categoryName) => {
acc[categoryName] = {
name: categoryName,
Expand All @@ -197,10 +197,10 @@ function WorkspaceCategoriesPage({policy, policyCategories, route}: WorkspaceCat
});
}

const disabledCategories = selectedCategoriesArray.filter((categoryName) => !policyCategories?.[categoryName].enabled);
const disabledCategories = selectedCategoriesArray.filter((categoryName) => !policyCategories?.[categoryName]?.enabled);
if (disabledCategories.length > 0) {
const categoriesToEnable = selectedCategoriesArray
.filter((categoryName) => !policyCategories?.[categoryName].enabled)
.filter((categoryName) => !policyCategories?.[categoryName]?.enabled)
.reduce<Record<string, {name: string; enabled: boolean}>>((acc, categoryName) => {
acc[categoryName] = {
name: categoryName,
Expand Down

0 comments on commit 34fa987

Please sign in to comment.