From aa8e514133d0cd085fb114fec2e8bed34a6427ed Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Thu, 5 Sep 2024 11:36:57 +0530 Subject: [PATCH] fix: Tags - App closes RHP after upgrade and clicking back button in GL code page. Signed-off-by: krishna2323 --- src/pages/workspace/tags/TagGLCodePage.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index 54e5c034ca07..89c281e91f4d 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -40,15 +40,19 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { const {tags} = PolicyUtils.getTagList(policyTags, orderWeight); const glCode = tags?.[route.params.tagName]?.['GL Code']; + const goBack = useCallback(() => { + Navigation.goBack(ROUTES.WORKSPACE_TAG_SETTINGS.getRoute(route.params.policyID, orderWeight, tagName)); + }, [orderWeight, route.params.policyID, tagName]); + const editGLCode = useCallback( (values: FormOnyxValues) => { const newGLCode = values.glCode.trim(); if (newGLCode !== glCode) { Tag.setPolicyTagGLCode(route.params.policyID, tagName, orderWeight, newGLCode); } - Navigation.goBack(ROUTES.WORKSPACE_TAG_SETTINGS.getRoute(route.params.policyID, orderWeight, tagName)); + goBack(); }, - [glCode, route.params.policyID, tagName, orderWeight], + [glCode, route.params.policyID, tagName, orderWeight, goBack], ); return ( @@ -65,7 +69,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { > Navigation.goBack()} + onBackButtonPress={goBack} />