You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-11-18] [$250] Distance - Blank map preview on employee side when selecting distance rate with different unit #51285
Version Number: v9.0.52-2 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers):applausetester+ck11020@applause.expensifail.com Issue reported by: Applause Internal Team
Action Performed:
Precondition:
Admin invited employee to workspace
Distance rates enabled in WS settings & Unit set to Miles in distance rates settings
Employee' side:
Navigate to staging.new.expensify.com
Click >> FAB >> Submit Expense >> Distance tab
Submit distance expense
Go to expense details page
Admin's side:
Go to WS settings >> Distance rates
Select settings option
Change the unit to Kilometer
Employee's side:
On the expense details page, select distance rate field
Select a different rate
Expected Result:
When admin changes the distance unit setting, map preview for distance expense should update on employee side on selecting distance rate with different unit
However, map preview on admin's side in expense details page gets updated as expected
Actual Result:
Blank map preview on employee side when selecting distance rate with different unit
@lschurr FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
What changes do you think we should make in order to solve the problem?
When newDistanceUnit is different from existingDistanceUnit we are changing comment.customUnit.quantity and we aren't touching the waypoints in any way so we do not need to set pendinFields waypoints. Hence, we should remove this line
But updatedTransaction is only a shadow clone of transaction then transaction that is getting from allTransactions is updated when we use lodashSet. Then when optimistic data is merged pendingFields.waypoints is update in Onyx
And this pendingFields isn't cleared in success data because updatedTransaction.pendingFields is an empty object which causes clearedPendingFields not to include waypoint field
But pendingFields.waypoints is also used to check whether we're fetching the waypoints from the server or not then I think we should separate these cases to use two pendingFields
For this case, I think we can use pendingFields.merchant because only the display distance text is changed
What alternative solutions did you explore? (Optional)
If we still want to display a blank view until the API is complete we can skip point 1 above
Or if we don't want to gray out the distance field when updating to a different unit, we can remove this line but we still need to deep clone the transaction to prevent the same case can happen in the feature.
changed the title [-]Distance - Blank map preview on employee side when selecting distance rate with different unit[/-][+][$250] Distance - Blank map preview on employee side when selecting distance rate with different unit[/+]on Oct 23, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.59-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@ishpaul777@lschurr The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not Critical but a edge case now its fixed no neeed to start a discussion
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Yes, it would be good to have a regression test
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
melvin-bot commentedon Oct 22, 2024
Triggered auto assignment to @lschurr (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.IuliiaHerets commentedon Oct 22, 2024
We think that this bug might be related to #wave-collect - Release 1
IuliiaHerets commentedon Oct 22, 2024
@lschurr FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
FitseTLT commentedon Oct 23, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Distance - Blank map preview on employee side when selecting distance rate with different unit
What is the root cause of that problem?
When the newDistanceUnit is different from existingDistanceUnit we are setting pendingFields waypoints here
App/src/libs/TransactionUtils/index.ts
Line 291 in ca942ca
What changes do you think we should make in order to solve the problem?
When newDistanceUnit is different from existingDistanceUnit we are changing
comment.customUnit.quantityand we aren't touching the waypoints in any way so we do not need to set pendinFields waypoints. Hence, we should remove this lineApp/src/libs/TransactionUtils/index.ts
Line 291 in ca942ca
What alternative solutions did you explore? (Optional)
nkdengineer commentedon Oct 23, 2024
Edited by proposal-police: This proposal was edited at 2024-10-30 04:59:47 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Blank map preview on employee side when selecting distance rate with different unit
What is the root cause of that problem?
When we change the distance rate if the unit is changed, we will add
pendingFields.waypointstoupdatedTransactionApp/src/libs/TransactionUtils/index.ts
Lines 283 to 291 in e2d99b4
We override
pendingFieldshere which causesupdatedTransaction.pendingFieldsto be an empty objectApp/src/libs/TransactionUtils/index.ts
Line 326 in e2d99b4
But
updatedTransactionis only a shadow clone oftransactionthentransactionthat is getting fromallTransactionsis updated when we uselodashSet. Then when optimistic data is mergedpendingFields.waypointsisupdatein OnyxApp/src/libs/TransactionUtils/index.ts
Line 239 in e2d99b4
And this pendingFields isn't cleared in success data because
updatedTransaction.pendingFieldsis an empty object which causesclearedPendingFieldsnot to includewaypointfieldApp/src/libs/actions/IOU.ts
Line 2738 in f251dbc
After all,
pendingFields.waypointsisn't cleared then the map view isn't shown hereApp/src/components/ReportActionItem/ReportActionItemImage.tsx
Lines 86 to 89 in e2d99b4
What changes do you think we should make in order to solve the problem?
pendingFields.waypointshere to gray out the distance field when we change the distance rate offline.App/src/libs/TransactionUtils/index.ts
Lines 283 to 291 in e2d99b4
But
pendingFields.waypointsis also used to check whether we're fetching the waypoints from the server or not then I think we should separate these cases to use two pendingFieldsFor this case, I think we can use
pendingFields.merchantbecause only the display distance text is changedApp/src/libs/TransactionUtils/index.ts
Lines 283 to 291 in e2d99b4
App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 309 in e2d99b4
App/src/libs/TransactionUtils/index.ts
Line 326 in e2d99b4
lodashCloneDeepfromlodash/cloneDeepApp/src/libs/TransactionUtils/index.ts
Line 239 in e2d99b4
pendingFieldsvariable then it can be updated correctly in optimistic data.App/src/libs/actions/IOU.ts
Line 2520 in 6cd5c64
What alternative solutions did you explore? (Optional)
If we still want to display a blank view until the API is complete we can skip point 1 above
Or if we don't want to gray out the distance field when updating to a different unit, we can remove this line but we still need to deep clone the transaction to prevent the same case can happen in the feature.
App/src/libs/TransactionUtils/index.ts
Line 291 in e2d99b4
[-]Distance - Blank map preview on employee side when selecting distance rate with different unit[/-][+][$250] Distance - Blank map preview on employee side when selecting distance rate with different unit[/+]melvin-bot commentedon Oct 23, 2024
Job added to Upwork: https://www.upwork.com/jobs/~021849108498732119693
melvin-bot commentedon Oct 23, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ishpaul777 (
External)melvin-bot commentedon Oct 28, 2024
@lschurr, @ishpaul777 Eep! 4 days overdue now. Issues have feelings too...
22 remaining items
melvin-bot commentedon Nov 11, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Nov 11, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.59-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-11-18. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Nov 11, 2024
@ishpaul777 @lschurr The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
twisterdotcom commentedon Nov 18, 2024
Relabelling as Lauren is OOO now.
melvin-bot commentedon Nov 18, 2024
Triggered auto assignment to @Christinadobrzyn (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.Christinadobrzyn commentedon Nov 19, 2024
@ishpaul777 do we need a regression test for this?
ishpaul777 commentedon Nov 19, 2024
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/50001/files#r1847961062
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not Critical but a edge case now its fixed no neeed to start a discussion
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Yes, it would be good to have a regression test
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/446154
Regression Test Proposal
Precondition:
Test:
Employee' side:
Admin's side:
Employee's side:
Verify Expected Result:
Map preview for distance expense should update on employee side on selecting distance rate with different unit and should not be blank.
Do we agree 👍 or 👎
Christinadobrzyn commentedon Nov 20, 2024
Thanks @ishpaul777! I paid out through Upwork based on this payment summary.
Closing!