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
[$500] Web - Report Preview in Report Screen shows up even after deletion of Money Request #26627
Use FAB on a ChatReport and generate money request
Click on IOUReport to show the IOUReport
Use menu to delete the Money Request
Come back to ChatReport of Step 1
Reload the page.
Expected Result:
Report Previous should not show up for a deleted Money Request
Actual Result:
Report Preview shows up for a deleted Money Request
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.62.0 Reproducible in staging?: y Reproducible in production?: y 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
Please re-state the problem that we are trying to solve in this issue.
Web - Report Preview in Report Screen shows up even after deletion of Money Request
What is the root cause of that problem?
The problem occurs because we are not clearing the Report Preview on the deletion of the IOU Report. . Further, pendingAction is not set for ReportPreview for Offline support.
What changes do you think we should make in order to solve the problem?
This can be solved by clearing up the Report Preview when IOU Report is deleted at this location within successData of deleteMoneyRequest method
Please re-state the problem that we are trying to solve in this issue.
Report preview in report page shows again even after money request is deleted
What is the root cause of that problem?
When we delete a money request, deleteMoneyRequest function is called.
As you can see, if shouldDeleteIOUReport is true, we optimistically merge the report preview action with null
We remove the keys with null value in modifiedData and call Storage.mergeItem. This means null values are not updated in storage though they are updated in memory. This bug looks like was introduced by this PR
This is the root cause of this issue
What changes do you think we should make in order to solve the problem?
In Onyx.merge function, we merge the changes with existing data and remove all keys with null values, we have to call Storage.setItem instead of Storage.mergeItem
This works as expected
Result26627.mp4
What alternative solutions did you explore? (Optional)
Calling Storage.setItem instead of Storage.mergeItem is definitely not what we want to do here, because we added JSON_PATCH functionality for SQLite on native here.
I just discovered the potential problem. I think it’s related to the idb-keyval PR by @hannojg. The problem is, that before this PR, on web we just set the modified data with the nullish keys removed already. After this PR, on web we’re using yet another merge funcationality, which will not drop the nullish keys, because the modified data with the removed nullish keys will be merged.
@muttmuure this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@allroundexperts@muttmuure
Can we not close this issue if the issue is fixed already?
Also, there are other issues dependent on the resolution of this one. Closing this would help us move further on the other issues.
Activity
melvin-bot commentedon Sep 3, 2023
Triggered auto assignment to @muttmuure (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Sep 3, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)rojiphil commentedon Sep 4, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Web - Report Preview in Report Screen shows up even after deletion of Money Request
What is the root cause of that problem?
The problem occurs because we are not clearing the Report Preview on the deletion of the IOU Report. . Further,
pendingActionis not set for ReportPreview for Offline support.What changes do you think we should make in order to solve the problem?
successDataofdeleteMoneyRequestmethodThe changes can be as follows:
pendingActiontoDELETEas follows hereWhat alternative solutions did you explore? (Optional)
dummy-1111 commentedon Sep 4, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Report preview in report page shows again even after money request is deleted
What is the root cause of that problem?
When we delete a money request, deleteMoneyRequest function is called.
As you can see, if
shouldDeleteIOUReportis true, we optimistically merge the report preview action with nullApp/src/libs/actions/IOU.js
Lines 1183 to 1189 in d971190
And the
deleteMoneyRequestAPI returns{[reportPreviewActionID]: null}, too.The problem is in
Onyx.mergePlease check the code here
We remove the keys with null value in
modifiedDataand callStorage.mergeItem. This means null values are not updated in storage though they are updated in memory. This bug looks like was introduced by this PRThis is the root cause of this issue
What changes do you think we should make in order to solve the problem?
In Onyx.merge function, we merge the changes with existing data and remove all keys with null values, we have to call
Storage.setIteminstead ofStorage.mergeItemThis works as expected
Result
26627.mp4
What alternative solutions did you explore? (Optional)
chrispader commentedon Sep 5, 2023
Calling Storage.setItem instead of Storage.mergeItem is definitely not what we want to do here, because we added JSON_PATCH functionality for SQLite on native here.
I just discovered the potential problem. I think it’s related to the idb-keyval PR by @hannojg. The problem is, that before this PR, on web we just set the modified data with the nullish keys removed already. After this PR, on web we’re using yet another merge funcationality, which will not drop the nullish keys, because the modified data with the removed nullish keys will be merged.
I’m gonna open a PR, which fixes this.
dummy-1111 commentedon Sep 5, 2023
I hope you open the PR asap. I think this bug may cause several issues
melvin-bot commentedon Sep 11, 2023
@muttmuure Still overdue 6 days?! Let's take care of this!
chrispader commentedon Sep 11, 2023
@s-alves10 just created a PR in Onyx that fixes this issue: Expensify/react-native-onyx#333
melvin-bot commentedon Sep 13, 2023
@muttmuure 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
melvin-bot commentedon Sep 15, 2023
@muttmuure 10 days overdue. I'm getting more depressed than Marvin.
melvin-bot commentedon Sep 17, 2023
@muttmuure this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
22 remaining items
melvin-bot commentedon Oct 1, 2023
Current assignee @allroundexperts is eligible for the Internal assigner, not assigning anyone new.
melvin-bot commentedon Oct 3, 2023
@allroundexperts, @muttmuure 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
muttmuure commentedon Oct 3, 2023
No proposals, going to come back in a week and see if this is reproducible
rojiphil commentedon Oct 3, 2023
@muttmuure
As I understand, the PR in this comment was supposed to resolve this issue.
@chrispader @s-alves10 can confirm
mvtglobally commentedon Oct 5, 2023
Issue not reproducible during KI retests. (First week)
mvtglobally commentedon Oct 12, 2023
Issue not reproducible during KI retests. (Second week)
rojiphil commentedon Oct 19, 2023
@allroundexperts @muttmuure
Can we not close this issue if the issue is fixed already?
Also, there are other issues dependent on the resolution of this one. Closing this would help us move further on the other issues.
miljakljajic commentedon Oct 19, 2023
This hasn't been reproducible for two weeks [following this PR] (#26627 (comment)) - closing. Thank you @rojiphil !
rojiphil commentedon Oct 25, 2023
@miljakljajic @muttmuure
Don't I qualify for a reporter bonus here as I had reported the bug?