Skip to content

Commit

Permalink
Merge pull request #48619 from Krishna2323/krishna2323/issue/48207
Browse files Browse the repository at this point in the history
fix: Tags - App closes RHP after upgrade and clicking back button in GL code page.
  • Loading branch information
MonilBhavsar authored Sep 5, 2024
2 parents 2797f92 + aa8e514 commit 06c76c9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pages/workspace/tags/TagGLCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => {
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 (
Expand All @@ -65,7 +69,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) {
>
<HeaderWithBackButton
title={translate('workspace.tags.glCode')}
onBackButtonPress={() => Navigation.goBack()}
onBackButtonPress={goBack}
/>
<FormProvider
formID={ONYXKEYS.FORMS.WORKSPACE_TAG_FORM}
Expand Down

0 comments on commit 06c76c9

Please sign in to comment.