From ac1dc1155c859f4b988e7759fe9a682b5fc7a775 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Sun, 2 Jun 2024 16:25:19 +0530 Subject: [PATCH] Don't call api if no changes were made to tax name --- src/pages/workspace/taxes/NamePage.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/taxes/NamePage.tsx b/src/pages/workspace/taxes/NamePage.tsx index dfcad933b7b0..53b8964787d4 100644 --- a/src/pages/workspace/taxes/NamePage.tsx +++ b/src/pages/workspace/taxes/NamePage.tsx @@ -45,7 +45,11 @@ function NamePage({ const goBack = useCallback(() => Navigation.goBack(ROUTES.WORKSPACE_TAX_EDIT.getRoute(policyID ?? '', taxID)), [policyID, taxID]); const submit = () => { - renamePolicyTax(policyID, taxID, name); + const taxName = name.trim(); + // Do not call the API if the edited tax name is the same as the current tag name + if (currentTaxRate?.name !== taxName) { + renamePolicyTax(policyID, taxID, taxName); + } goBack(); };