diff --git a/src/libs/actions/DemoActions.js b/src/libs/actions/DemoActions.js index fc4d2ece4b52..4ba9f6ee33a0 100644 --- a/src/libs/actions/DemoActions.js +++ b/src/libs/actions/DemoActions.js @@ -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; }