From d562acf61f64a2a8a878c0ecf34f003007d6939b Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sun, 29 Sep 2024 04:28:22 +0530 Subject: [PATCH 1/4] fix: Categories - RBR appears next to workspace after selecting the deleted spend category offline. Signed-off-by: krishna2323 --- .../workspace/categories/WorkspaceCategoriesSettingsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx index 5a048e3bdc36..508b7b417b58 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx @@ -69,7 +69,7 @@ function WorkspaceCategoriesSettingsPage({policy, route}: WorkspaceCategoriesSet const isToggleDisabled = !policy?.areCategoriesEnabled || !hasEnabledOptions || isConnectedToAccounting; const setNewCategory = (selectedCategory: ListItem) => { - if (!selectedCategory.keyForList || !groupID) { + if (!selectedCategory.keyForList || !groupID || categoryID === selectedCategory.keyForList) { return; } Policy.setWorkspaceDefaultSpendCategory(policyID, groupID, selectedCategory.keyForList); From 9d382ac84daeb93251196d7061fae5202e696e89 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sun, 29 Sep 2024 04:50:47 +0530 Subject: [PATCH 2/4] minor update. Signed-off-by: krishna2323 --- .../categories/WorkspaceCategoriesSettingsPage.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx index 508b7b417b58..baec75fd318f 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx @@ -69,7 +69,11 @@ function WorkspaceCategoriesSettingsPage({policy, route}: WorkspaceCategoriesSet const isToggleDisabled = !policy?.areCategoriesEnabled || !hasEnabledOptions || isConnectedToAccounting; const setNewCategory = (selectedCategory: ListItem) => { - if (!selectedCategory.keyForList || !groupID || categoryID === selectedCategory.keyForList) { + if (!selectedCategory.keyForList || !groupID) { + return; + } + if (categoryID === selectedCategory.keyForList) { + setIsSelectorModalVisible(false); return; } Policy.setWorkspaceDefaultSpendCategory(policyID, groupID, selectedCategory.keyForList); From 531709d51c722f6042bd6337261ad3b308b6141e Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 30 Sep 2024 06:45:23 +0530 Subject: [PATCH 3/4] minor update. Signed-off-by: krishna2323 --- .../workspace/categories/WorkspaceCategoriesSettingsPage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx index baec75fd318f..f33bcbf56657 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx @@ -72,11 +72,10 @@ function WorkspaceCategoriesSettingsPage({policy, route}: WorkspaceCategoriesSet if (!selectedCategory.keyForList || !groupID) { return; } - if (categoryID === selectedCategory.keyForList) { - setIsSelectorModalVisible(false); + if (categoryID !== selectedCategory.keyForList) { + Policy.setWorkspaceDefaultSpendCategory(policyID, groupID, selectedCategory.keyForList); return; } - Policy.setWorkspaceDefaultSpendCategory(policyID, groupID, selectedCategory.keyForList); setIsSelectorModalVisible(false); }; From 72750b612f55f6d62587974a573df774e095eed7 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Thu, 3 Oct 2024 21:33:54 +0530 Subject: [PATCH 4/4] minor fix. Signed-off-by: krishna2323 --- .../workspace/categories/WorkspaceCategoriesSettingsPage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx index f33bcbf56657..0a492252f9d4 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesSettingsPage.tsx @@ -74,7 +74,6 @@ function WorkspaceCategoriesSettingsPage({policy, route}: WorkspaceCategoriesSet } if (categoryID !== selectedCategory.keyForList) { Policy.setWorkspaceDefaultSpendCategory(policyID, groupID, selectedCategory.keyForList); - return; } setIsSelectorModalVisible(false); };