From 2d6389411cbcc7472638ff85fbb61b5b3fe35b91 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Wed, 6 Sep 2023 10:36:25 +0800 Subject: [PATCH] Navigate home if we don't get onyx data returned --- src/libs/actions/DemoActions.js | 6 ++++++ 1 file changed, 6 insertions(+) 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; }