Closed m-natarajan closed 2 weeks ago
Triggered auto assignment to @strepanier03 (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.
@strepanier03 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
We think that this bug might be related to #wave-collect - Release 1
App crashes.
The reportIDToTransactions[reportKey]
can be undefined when we delete all expense
We should check reportIDToTransactions[reportKey]
is undefined or not before update here
} else if (reportIDToTransactions[reportKey]) {
reportIDToTransactions[reportKey].transactions = [transaction];
}
The app crash when deleting all expense in Shared search page.
When we delete one of the expenses from the Expense tab and then open the Shared tab, the search API result still shows the deleted expense. The search API response returns an Onyx merge request that actually doesn't include the deleted expense, but because it's a merge request, the deleted expense isn't removed from Onyx.
For example, let's say we delete transaction1. [transaction1, transaction2] merge with [transaction2] -> [transaction1, transaction2]
Nothing changed.
The API should return null for the deleted transaction so it's removed from Onyx. Now, when we delete the grouped expense, it will delete the whole transaction. For this one, the DeleteMoneyRequestOnSearch
request clears both the IOU report and the other transactions (transaction2 in our example) correctly.
But because the transaction1 still exists and the page re-renders, it eventually crashes in this block. https://github.com/Expensify/App/blob/b928e40d997ed2bb11bc9b990f16e422f1121bcb/src/libs/SearchUtils.ts#L209-L211
The reason is that reportIDToTransactions[reportKey]
is undefined, but we are trying to access and set the transactions
attribute. It's undefined because we haven't initialized the mapping for the specific reportKey
yet.
The way it works is that it will initialize the reportIDToTransactions[reportKey]
from the IOU report data,
https://github.com/Expensify/App/blob/b928e40d997ed2bb11bc9b990f16e422f1121bcb/src/libs/SearchUtils.ts#L162-L179
then when it encounters a transaction
, it will just update the reportIDToTransactions[reportKey].transactions
.
https://github.com/Expensify/App/blob/b928e40d997ed2bb11bc9b990f16e422f1121bcb/src/libs/SearchUtils.ts#L207-L211
But in our case, the IOU report is already deleted and the transaction1 still exists, thus it crashes.
Initialize the object instead of directly accessing the property.
reportIDToTransactions[reportKey] = {
...(reportIDToTransactions[reportKey] ?? {}),
transactions: [transaction]
};
Putting this forward for now, but I'm unable to test as I'm troubleshooting a different issue with loading staging atm.
Job added to Upwork: https://www.upwork.com/jobs/~01d3b370e3b25c0229
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External
)
@rojiphil, @strepanier03 Whoops! This issue is 2 days overdue. Let's get this updated quick!
Reviewing today
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
Hmm… I am unsure why the deleted expense is not removed from the shared
search results. Isn’t that the problem to be addressed here?
cc @luacmartins
We should fix the transaction not being removed in the first place, but we can also introduce the conditional chaining to be safe and prevent a crash. For the first solution, I'm thinking of making the API return a set
onyx update if offset = 0, since we always want to clear the results and start fresh in that case. Subsequent requests with offset > 0 would use a merge
operation.
@rojiphil @strepanier03 @luacmartins this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@rojiphil, @strepanier03, @luacmartins Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@rojiphil, @strepanier03, @luacmartins Still overdue 6 days?! Let's take care of this!
@rojiphil, @strepanier03, @luacmartins Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@rojiphil, @strepanier03, @luacmartins 10 days overdue. Is anyone even seeing these? Hello?
@rojiphil @strepanier03 @luacmartins this issue is now 4 weeks old, please consider:
Thanks!
This issue has not been updated in over 14 days. @rojiphil, @strepanier03, @luacmartins eroding to Weekly issue.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
Issue not reproducible during KI retests. (First week)
This is fixed. Closing.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.7-4 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 Expensify/Expensify Issue URL: Issue reported by: applause internal team Slack conversation:
Action Performed:
Expected Result:
App will not crash.
Actual Result:
App crashes.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
[Uploading Bug6543392_1721092873177!staging.new.expensify.com-1721092641739.txt…]()
https://github.com/user-attachments/assets/e468a306-3adf-47ea-be6f-1d668aaae7c7
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @rojiphil