Skip to content

Commit 06c76c9

Browse files
authored
Merge pull request #48619 from Krishna2323/krishna2323/issue/48207
fix: Tags - App closes RHP after upgrade and clicking back button in GL code page.
2 parents 2797f92 + aa8e514 commit 06c76c9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/pages/workspace/tags/TagGLCodePage.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,19 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) {
4040
const {tags} = PolicyUtils.getTagList(policyTags, orderWeight);
4141
const glCode = tags?.[route.params.tagName]?.['GL Code'];
4242

43+
const goBack = useCallback(() => {
44+
Navigation.goBack(ROUTES.WORKSPACE_TAG_SETTINGS.getRoute(route.params.policyID, orderWeight, tagName));
45+
}, [orderWeight, route.params.policyID, tagName]);
46+
4347
const editGLCode = useCallback(
4448
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => {
4549
const newGLCode = values.glCode.trim();
4650
if (newGLCode !== glCode) {
4751
Tag.setPolicyTagGLCode(route.params.policyID, tagName, orderWeight, newGLCode);
4852
}
49-
Navigation.goBack(ROUTES.WORKSPACE_TAG_SETTINGS.getRoute(route.params.policyID, orderWeight, tagName));
53+
goBack();
5054
},
51-
[glCode, route.params.policyID, tagName, orderWeight],
55+
[glCode, route.params.policyID, tagName, orderWeight, goBack],
5256
);
5357

5458
return (
@@ -65,7 +69,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) {
6569
>
6670
<HeaderWithBackButton
6771
title={translate('workspace.tags.glCode')}
68-
onBackButtonPress={() => Navigation.goBack()}
72+
onBackButtonPress={goBack}
6973
/>
7074
<FormProvider
7175
formID={ONYXKEYS.FORMS.WORKSPACE_TAG_FORM}

0 commit comments

Comments
 (0)