Skip to content

Commit 013feee

Browse files
committed
fix return when click already selected category
1 parent 93b33f2 commit 013feee

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/pages/workspace/categories/DynamicDefaultCategorySelectorPage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ function DynamicDefaultCategorySelectorPage({route}: DynamicDefaultCategorySelec
2626
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.DEFAULT_CATEGORY_SELECTOR.path);
2727

2828
const onCategorySelected = (selectedCategory: ListItem) => {
29-
if (!selectedCategory.searchText || currentCategory === selectedCategory.searchText) {
29+
if (!selectedCategory.searchText) {
30+
return;
31+
}
32+
if (currentCategory === selectedCategory.searchText) {
33+
Navigation.goBack(backPath);
3034
return;
3135
}
3236
setPolicyCustomUnitDefaultCategory(policyID, customUnitID, currentCategory, selectedCategory.searchText);

src/pages/workspace/categories/DynamicSpendCategorySelectorPage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ function DynamicSpendCategorySelectorPage({route}: DynamicSpendCategorySelectorP
2828
const currentCategory = policy?.mccGroup?.[groupID]?.category ?? '';
2929

3030
const onCategorySelected = (selectedCategory: ListItem) => {
31-
if (!selectedCategory.keyForList || currentCategory === selectedCategory.keyForList) {
31+
if (!selectedCategory.keyForList) {
32+
return;
33+
}
34+
if (currentCategory === selectedCategory.keyForList) {
35+
Navigation.goBack(backPath);
3236
return;
3337
}
3438
setWorkspaceDefaultSpendCategory(policyID, groupID, selectedCategory.keyForList, policy?.mccGroup);

0 commit comments

Comments
 (0)