diff --git a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx index 832c07c90431..fab3323fc44a 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx @@ -43,7 +43,7 @@ function WorkspaceCategoriesPage({policyCategories}: WorkspaceCategoriesPageProp const {translate} = useLocalize(); const [selectedCategories, setSelectedCategories] = useState([]); - const data = useMemo( + const categoryList = useMemo( () => Object.values(policyCategories ?? {}).map((value) => ({ value: value.name, @@ -75,11 +75,11 @@ function WorkspaceCategoriesPage({policyCategories}: WorkspaceCategoriesPageProp }; const toggleAllCategories = () => { - const isAllSelected = data.every((category) => category.isSelected); + const isAllSelected = categoryList.every((category) => category.isSelected); if (isAllSelected) { setSelectedCategories([]); } else { - setSelectedCategories(data.map((item) => item.value)); + setSelectedCategories(categoryList.map((item) => item.value)); } }; @@ -97,7 +97,7 @@ function WorkspaceCategoriesPage({policyCategories}: WorkspaceCategoriesPageProp />