Skip to content

Commit

Permalink
fix: Report.fetchAllReports - Navigation.navigate does not work when …
Browse files Browse the repository at this point in the history
…no router is mounted
  • Loading branch information
kidroca committed Apr 26, 2021
1 parent da36c16 commit c4d25f5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,15 @@ function fetchOrCreateChatReport(participants, shouldNavigate = true) {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${data.reportID}`, {reportID: data.reportID});

if (shouldNavigate) {
// Redirect the logged in person to the new report
Navigation.navigate(ROUTES.getReportRoute(data.reportID));
try {
// Redirect the logged in person to the new report
Navigation.navigate(ROUTES.getReportRoute(data.reportID));
} catch (e) {
// When switching between the Auth and Public routers there's a brief time of no navigator mounted
console.error(e);
}
}

return data.reportID;
});
}
Expand Down

0 comments on commit c4d25f5

Please sign in to comment.