-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Separate report name and icon configuration from personal details #7367
Conversation
src/libs/actions/Report.js
Outdated
PersonalDetails.getFromReportParticipants(_.values(simplifiedReports)); | ||
|
||
// Configure Report Name and Report Icon | ||
configureReportNameAndIcon(_.values(simplifiedReports)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be race conditions here personal details may have not been stored in Onyx when this is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise.resolve(PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))).then(
details => configureReportNameAndIcon(_.values(simplifiedReports), details),
);
@parasharrajat It will solve the issue. Any suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't be needed when PersonalDetails.getFromReportParticipants
will return a promise.
src/libs/actions/Report.js
Outdated
Onyx.connect({ | ||
key: ONYXKEYS.PERSONAL_DETAILS, | ||
callback: (formattedPersonalDetails) => { | ||
const reportsToUpdate = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are you canceling the subscription?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find anything about cancelling the subscription in the code as well as documentation.
Do you mean?
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS,
callback: (formattedPersonalDetails) => {
+ if (!formattedPersonalDetails) {
+ return;
+ }
const reportsToUpdate = {};
I am planing not to connect to onyx here. Instead use the returned value from PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is a good idea.
Action methods should only have return values (data or a promise) if they are called by other actions. This is done to encourage that action methods can be called in parallel with no dependency on other methods (see discussion above).
src/libs/actions/Report.js
Outdated
Promise.resolve(PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))).then( | ||
details => configureReportNameAndIcon(_.values(simplifiedReports), details), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise.resolve(PersonalDetails.getFromReportParticipants(_.values(simplifiedReports))).then( | |
details => configureReportNameAndIcon(_.values(simplifiedReports), details), | |
); | |
const simplifiedReportsList = _.values(simplifiedReports); | |
PersonalDetails.getFromReportParticipants(simplifiedReportsList) | |
.then(details => configureReportNameAndIcon(simplifiedReportsList, details)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we should also return promise in case particpantEmails.length === 0 from PersonalDetails.getFromReportParticipants()
if (participantEmails.length === 0) {
return Promise.resolve();
}
@parasharrajat Any Suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is fine. the interface should be consistent.
if (participantEmails.length === 0) {
return Promise.resolve([]); // if details is array then empty array.
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Heyo, this is causing #7417 so this will be reverted. |
@parasharrajat I have updated the branch which should probably solve the issue. It solves the issue in my side. Could you please verify? Should I create a new PR? |
Yeah, please create a new PR |
🚀 Deployed to production by @roryabraham in version: 1.1.33-3 🚀
|
Details
Solve the issue of report names and icons.
Fixed Issues
$ #7261
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android