Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated code to remove dependency on IS_LOADING_POLICY_DATA for Welcome.js #11627

Merged
merged 7 commits into from
Oct 20, 2022
9 changes: 6 additions & 3 deletions src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,20 @@ function openApp() {
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: true,
}],
},
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange I thought we'd prefer what was there before (}]) did the linter complain about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 I think the other way reads better. Same for the others.

successData: [{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: false,
}],
},
],
failureData: [{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: false,
}],
},
],
});
}

Expand Down
12 changes: 1 addition & 11 deletions src/libs/actions/Welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ let isReadyPromise = new Promise((resolve) => {

let isFirstTimeNewExpensifyUser;
let isLoadingReportData = true;
let isLoadingPolicyData = true;
let email = '';

/**
Expand All @@ -28,7 +27,7 @@ let email = '';
* - Whether we have loaded all reports the server knows about
*/
function checkOnReady() {
if (!_.isBoolean(isFirstTimeNewExpensifyUser) || isLoadingPolicyData || isLoadingReportData) {
if (!_.isBoolean(isFirstTimeNewExpensifyUser) || isLoadingReportData) {
return;
}

Expand All @@ -53,15 +52,6 @@ Onyx.connect({
},
});

Onyx.connect({
key: ONYXKEYS.IS_LOADING_POLICY_DATA,
initWithStoredValues: false,
callback: (val) => {
isLoadingPolicyData = val;
checkOnReady();
},
});

const allReports = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
Expand Down