Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Tags - App closes RHP after upgrade and clicking back button in GL code page. #48619

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading