From a4a0bd236a4b8d3ea35d20664ee248b6a72c3f83 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Tue, 20 Apr 2021 07:53:14 -1000 Subject: [PATCH] use set() update key name and add comments --- src/Expensify.js | 10 +++++----- src/ONYXKEYS.js | 5 +++-- src/libs/actions/Report.js | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Expensify.js b/src/Expensify.js index b3289e8559b4..6d8fe67927b0 100644 --- a/src/Expensify.js +++ b/src/Expensify.js @@ -56,7 +56,7 @@ const propTypes = { updateAvailable: PropTypes.bool, // Whether the initial data needed to render the app is ready - appDataLoaded: PropTypes.bool, + initialReportDataLoaded: PropTypes.bool, }; const defaultProps = { @@ -65,7 +65,7 @@ const defaultProps = { accountID: null, }, updateAvailable: false, - appDataLoaded: false, + initialReportDataLoaded: false, }; class Expensify extends PureComponent { @@ -108,7 +108,7 @@ class Expensify extends PureComponent { BootSplash.show({fade: true}); } - if (this.getAuthToken() && this.props.appDataLoaded) { + if (this.getAuthToken() && this.props.initialReportDataLoaded) { BootSplash.getVisibilityStatus() .then((value) => { if (value !== 'visible') { @@ -151,7 +151,7 @@ export default withOnyx({ key: ONYXKEYS.UPDATE_AVAILABLE, initWithStoredValues: false, }, - appDataLoaded: { - key: ONYXKEYS.APP_DATA_LOADED, + initialReportDataLoaded: { + key: ONYXKEYS.INITIAL_REPORT_DATA_LOADED, }, })(Expensify); diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js index e909a58e6128..560ae58c043a 100644 --- a/src/ONYXKEYS.js +++ b/src/ONYXKEYS.js @@ -9,8 +9,9 @@ export default { // which tab is the leader, and which ones are the followers ACTIVE_CLIENTS: 'activeClients', - // A key that is set when we are still waiting for the initial round of reports to load - APP_DATA_LOADED: 'appDataLoaded', + // A key that is set while we are still waiting for the initial round of reports to load. Once set it should not be + // false unless we sign out. If there are reports in storage when the app inits this will be `true`. + INITIAL_REPORT_DATA_LOADED: 'initialReportDataLoaded', NETWORK_REQUEST_QUEUE: 'networkRequestQueue', diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index ea05eddde8b8..cd3e7cfbe6fe 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -315,7 +315,7 @@ function fetchChatReportsByIDs(chatList) { // than updating props for each report and re-rendering had merge been used. Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT_IOUS, reportIOUData); Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, simplifiedReports); - Onyx.merge(ONYXKEYS.APP_DATA_LOADED, true); + Onyx.set(ONYXKEYS.INITIAL_REPORT_DATA_LOADED, true); // Fetch the personal details if there are any PersonalDetails.getFromReportParticipants(Object.values(simplifiedReports));