Skip to content

Commit

Permalink
Show not found page instead of going back
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Aug 14, 2024
1 parent 5328303 commit 00868ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ function WorkspaceWorkflowsApprovalsCreatePage({policy, isLoadingReportData = tr
>
<HeaderWithBackButton
title={translate('workflowsCreateApprovalsPage.title')}
onBackButtonPress={() => {
Workflow.clearApprovalWorkflow();
Navigation.goBack();
}}
onBackButtonPress={Navigation.goBack}
/>
{approvalWorkflow && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function WorkspaceWorkflowsApprovalsEditPage({policy, isLoadingReportData = true
const formRef = useRef<ScrollView>(null);

// eslint-disable-next-line rulesdir/no-negated-variables
const shouldShowNotFoundView = (isEmptyObject(policy) && !isLoadingReportData) || !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy);
const shouldShowNotFoundView = (isEmptyObject(policy) && !isLoadingReportData) || !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy) || !approvalWorkflow;

const updateApprovalWorkflow = useCallback(() => {
if (!approvalWorkflow || !initialApprovalWorkflow) {
Expand Down Expand Up @@ -80,8 +80,7 @@ function WorkspaceWorkflowsApprovalsEditPage({policy, isLoadingReportData = true
const currentApprovalWorkflow = workflows.find((workflow) => workflow.approvers.at(0)?.email === route.params.firstApproverEmail);

if (!currentApprovalWorkflow) {
Workflow.clearApprovalWorkflow();
return Navigation.goBack(ROUTES.WORKSPACE_WORKFLOWS.getRoute(route.params.policyID));
return Workflow.clearApprovalWorkflow();
}

Workflow.setApprovalWorkflow({
Expand Down Expand Up @@ -110,10 +109,7 @@ function WorkspaceWorkflowsApprovalsEditPage({policy, isLoadingReportData = true
>
<HeaderWithBackButton
title={translate('workflowsEditApprovalsPage.title')}
onBackButtonPress={() => {
Workflow.clearApprovalWorkflow();
Navigation.goBack();
}}
onBackButtonPress={Navigation.goBack}
/>
{approvalWorkflow && (
<>
Expand Down

0 comments on commit 00868ec

Please sign in to comment.