Skip to content

Commit

Permalink
Merge pull request #26844 from Expensify/beaman-handlePostConfRouting
Browse files Browse the repository at this point in the history
[CP Staging] Navigate home if onyx data not returned from demo commands
  • Loading branch information
cristipaval authored Sep 6, 2023
2 parents 41526c3 + 2d63894 commit be539b4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libs/actions/DemoActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ function createDemoWorkspaceAndNavigate(workspaceOwnerEmail, apiCommand) {
// Get report updates from Onyx response data
const reportUpdate = _.find(response.onyxData, ({key}) => key === ONYXKEYS.COLLECTION.REPORT);
if (!reportUpdate) {
// If there's no related onyx data, navigate the user home so they're not stuck.
Navigation.goBack();
Navigation.navigate(ROUTES.HOME);
return;
}

// Get the policy expense chat update
const policyExpenseChatReport = _.find(reportUpdate.value, ({chatType}) => chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT);
if (!policyExpenseChatReport) {
// If there's no related onyx data, navigate the user home so they're not stuck.
Navigation.goBack();
Navigation.navigate(ROUTES.HOME);
return;
}

Expand Down

0 comments on commit be539b4

Please sign in to comment.