Closed kbecciv closed 1 year ago
Triggered auto assignment to @maddylewis (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Account B's display name on device A should synchronously update just after it has been renamed on account B's device
The problem here is that when we initialize commponent MoneyRequestConfirmationList
this.state.participants
is initialized in constructor with value calculated from this.getParticipantsWithAmount(props.participants)
. Therefore, if props.participants
changes, this.state.participants
is not updated accordingly.
And similarly in the MoneyRequestModal
component, the selectedOptions
is initialized . If props.report or props.personalDetails
changes after the MoneyRequestModal
component is initialized, selectedOptions
will not change accordingly.
https://github.com/Expensify/App/blob/8acc63040d8257859f988ff7b9804fea3acffc15/src/pages/iou/MoneyRequestModal.js#L107-L111
With MoneyRequestConfirmationList
we will add.
componentDidUpdate(prevProps) {
if (prevProps.participants !== this.props.participants) {
const formattedParticipants = _.map(this.getParticipantsWithAmount(this.props.participants), (participant) => ({
...participant,
selected: true,
}));
this.setState({ participants: formattedParticipants });
}
}
2. With `MoneyRequestModal`:
useEffect(() => { setSelectedOptions( ReportUtils.isPolicyExpenseChat(props.report) ? OptionsListUtils.getPolicyExpenseReportOptions(props.report) : OptionsListUtils.getParticipantsOptions(props.report, props.personalDetails), ); }, [props.report, props.personalDetails]);
Result:
https://github.com/Expensify/App/assets/39086067/4430913b-23a7-4a53-ad7b-116bbc3e4884
### What alternative solutions did you explore? (Optional)
N/A
When user A choose to split bill using LHN + button > Enter Amount > Choose User B > Next > reaching the confirmation page. If User B changes his/her user profile display name at this moment, the new name does not get reflected in user A's split bill confirmation page.
This issue happens because MoneyRequestConfirmationList.js
is displaying the split bill confirmation page using participants
in state. The state get populated from the selectedOptions
state in MoneyRequestModal.js
component but the difference is it get formatted with amount within MoneyRequestConfirmationList.js
.
When user B updates his profile display name, the names already stored within selectedOptions
does not get updated on Onyx personalDetails
key updates, and since there is no prop changes, there are also no updates being done in MoneyRequestConfirmationList.js
, hence the old user B display name still get shown.
useEffect
in MoneyRequestModal.js
to update the display text
field within selectedOptions
list object whenever there is an update of props.personalDetails
e.g.
useEffect(() => {
const newParticipants = _.chain(selectedOptions)
.map((p) => {
const newParticipant = _.clone(p);
const matchedPersonalDetail = lodashGet(props.personalDetails, newParticipant.alternateText);
if (matchedPersonalDetail) {
newParticipant.text = matchedPersonalDetail.displayName;
}
return newParticipant;
})
.value();
setSelectedOptions(newParticipants);
}, [props.personalDetails]);
componentDidUpdate
lifecycle function in MoneyRequestConfirmationList.js
, so that whenever props.participants
changes, they will get reformatted with amount and updated into the component state for rendering.e.g.
componentDidUpdate(prevProps) {
if (_.isEqual(prevProps.participants, this.props.participants)) {
return;
}
const formattedParticipants = _.map(this.getParticipantsWithAmount(this.props.participants), (participant) => ({
...participant,
selected: true,
}));
this.setState({participants: formattedParticipants});
}
By applying the changes above, MoneyRequestConfirmationList.js
will get updated with new participant display names when there is a pusher event to personalDetails.
N/A
Job added to Upwork: https://www.upwork.com/jobs/~01182a1297b99a7cd4
Current assignee @maddylewis is eligible for the External assigner, not assigning anyone new.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External
)
Triggered auto assignment to @MonilBhavsar (External
), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@abdulrahuman5196 Just would like to highlight that my proposal https://github.com/Expensify/App/issues/20010#issuecomment-1573465372 fixes the issue regardless if user choose to split bill from FAB + button, or from a group chat.
whereas the proposal by namhihi237 would only works when user split bill from group chat. In fact it causes a regression when split bill is done from FAB (which is what's demonstrated in the bug report video), as there will be no props.report.participants
when bill splitting is not done in a report, that will results in the participants list being updated to empty list when any of the participant update their name.
Appreciate your review.
Thanks! Let's put it on HOLD as the code coincides and might be fixed. Putting it on HOLD on issue https://github.com/Expensify/App/issues/17662
still holding for - https://github.com/Expensify/App/issues/17662
still on hold
No longer on hold. https://github.com/Expensify/App/issues/17662 is resolved.
Taking it off hold
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@namhihi237 and @honnamkuan do you want to update your proposal we have refactored the code. @abdulrahuman5196 could you help to review the proposals here, thanks!
@MonilBhavsar thanks for the ping. I just done some testing, seems like this issue is no longer reproducible after the refactoring changes.
Thanks, Let me check and feedback.
Hey @honnamkuan I just tested it right now, it is still reproducible, I will attach a video down below. It would help if you would share a screen recording with us to identify if there are any missed steps.
https://github.com/Expensify/App/assets/111440031/fe2527d8-372c-4885-9c1f-d4920874d260
The issue is fixed when you split bill with a user that you have a chat with.
https://github.com/Expensify/App/assets/50919443/84ed53c2-bbe4-431d-a886-c90c5444a834
The video (by @Nathan-Mulugeta) shows a split bill with a new user that you never chat before. If you never have a chat with a user, you don't have their personal detail data. Because we don't have the personal detail data, I think it's impossible to get the name (or anything) updates.
thanks for that breakdown @bernhardoj! to confirm, was the issue fixed via https://github.com/Expensify/App/issues/17662, or do we still need to address something here?
Technically, yes. But let's have a confirmation from @MonilBhavsar about this https://github.com/Expensify/App/issues/20010#issuecomment-1623052679
@MonilBhavsar
@bernhardoj 's response here is correct https://github.com/Expensify/App/issues/20010#issuecomment-1623052679
This issue is now happening only for user who you have never chatted with. What the expectation here? Should the display name change? AFAIK the answer is no, correct me if wrong.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
This doesn't seem like issue to me https://github.com/Expensify/App/issues/20010#issuecomment-1621778418 If there is not chat between users, we won't send pusher events for name update and it won't get updated. Not an issue IMO. cc @Beamanator @puneetlath buddy check please 🙏
Agreed @MonilBhavsar 👍
Yoo, thanks Alex 🙌
@maddylewis, we can close this issue now. It will be great to add regression testing steps for this flow. Reported issue was fixed by https://github.com/Expensify/App/pull/17964/ So, we need to pay reporting bonus to @Nathan-Mulugeta
sorry for the delay here! tomorrow morning i will pay the $250 reporting bonus to @Nathan-Mulugeta and then close the issue!
@maddylewis is processing payment
offer sent to @Nathan-Mulugeta
Just accepted offer @maddylewis
paid!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Account B's display name on device A should synchronously update just after it has been renamed on account B's device
Actual Result:
Renaming doesn't synchronously update on device A.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.22.0
Reproducible in staging?: yes
Reproducible in production?: yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://github.com/Expensify/App/assets/93399543/2b2aa9a4-0e90-4033-8f19-1d262717036b
https://github.com/Expensify/App/assets/93399543/a4bd99e5-81ad-45e7-a3c2-6dbd80db080b
Expensify/Expensify Issue URL:
Issue reported by: @Nathan-Mulugeta
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685512857055539
View all open jobs on GitHub
Upwork Automation - Do Not Edit