Closed lanitochka17 closed 8 months ago
Job added to Upwork: https://www.upwork.com/jobs/~01d3ed805fe8e7116d
Triggered auto assignment to @alexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External
)
Draft view for a new split bill is getting reset when creating a second split bill right after another.
I've managed to reproduce the issue by throttling my network, root cause is that part of the onyx successData is setting TRANSACTION_DRAFT as null.
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`,
value: null,
}
So when the network call finishes and we got a new split bill in progress it gets reset.
Remove the TRANSACTION_DRAFT merge to null from the successData inside IOU.createSplitsAndOnyxData
method
Instead of removing the transaction_draft, we can move it to the optimisticData, though it shouldn't be necessary since the transaction draft view is already cleaned up after submitting it.
Edit: removed reminder text
@abdulrahuman5196 - when you get a chance, can you review if this proposal will fix this issue? Thanks!
Heads up, I will be offline from Friday, December 22, to Thursday, January 4, 2024. I will not be actively watching over this GitHub during that period. If anything urgent is needed here, please ask for help in the #expensify-open-source Slack Room-- thanks!
Group members disappeared in a split bill when make second split bill in a row
We clear the transactionDraft
in successData
here. So if we create another split bill before the API is complete, this is removed and then group members are cleared.
transactionID
when creating a new request, we can generate a random transactionID
by using NumberUtils.rand64()
and then use it as the ID of the new transaction when we confirm to create it. This is the same way as we do for reportID
.And then we can replace CONST.IOU.OPTIMISTIC_TRANSACTION_ID
with this transactionID.
expired
which is 30 days (the days can be discussed in the PR) after the current date. Then whenever we open the app, we will call clearOldTransactionDraft
function. This function will clear all transactions draft which has expired
is less than the current date.Here is the test branch: https://github.com/dukenv0307/App/tree/fix/33518
For point 2, we can always clear all transaction drafts whenever we open the App. Although it's not good for the case user is starting the money request flow in another tab, this case is rare and we don't need to take care of this so much.
@alexpensify, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!
@alexpensify, @abdulrahuman5196 Huh... This is 4 days overdue. Who can take care of this?
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
Sorry for the delay. Will check in my morning.
Reviewing now
@dukenv0307 On proposal here https://github.com/Expensify/App/issues/33518#issuecomment-1868906093, it might not be that easy to replace the OPTIMISTIC_TRANSACTION_ID
, it seems to be used in multiple checks. Could you kindly update your proposal to see if all cases can be handled?
@adriancova on proposal here https://github.com/Expensify/App/issues/33518#issuecomment-1867998289, do you suggest to not clear the draft data? I am not sure if that would be a valid fix, since the stale data will be present in that case.
Tagging @tgolen, as he made the original change.
Could you kindly let us know if there is any specific reason to have the optimistic transaction id as constant OPTIMISTIC_TRANSACTION_ID
, since it could overlap with other transactions if we created multiple optimistic transaction of same report?
@abdulrahuman5196 https://github.com/dukenv0307/App/tree/fix/33518 Here is the change, of course we will need to re-test this carefully in the PR, this branch is the detail of the main ideal.
since it could overlap with other transactions if we created multiple optimistic transaction of same report
My first thought is that if this is happening, this is wrong. There should never be multiple draft transactions for the same report. Then I thought about the case where you want to create multiple requests while being offline, and maybe that's where my logic breaks down.
The reason for having OPTIMISTIC_TRANSACTION_ID
was the following:
TRANSACTIONS
collection with all other transactions. Halfway through the PR, this was moved to the TRANSACTIONS_DRAFT
collection, which solved part of the problem.isNewTransaction
property that @dukenv0307 is proposing). Though, this is more of a theoretical problem and not an actual problem.Ideally, it would be nice if the draft transaction ID was random, but we still need to figure out a way to clean up all the abandoned data so it doesn't keep growing. Maybe this could be solved with an Onyx migration that always removes the X oldest drafts?
@tgolen
Thank for your response
isNewTransaction
is added to replace the condition transactionID !== CONST.IOU.OPTIMISTIC_TRANSACTION_ID
To clear the transaction draft if we close the modal without saving, we can create a wrapper component for iou step and in this component we will clear the transaction draft if this component is umounted without saving.
Point 1 makes sense. For point 2, why is that any different than what we have today?
If we create the transaction, the draft is already cleared in successData
, so we only need to cover the case the user close the request flow without saving.
Issue not reproducible during KI retests. (First week)
@dukenv0307 Sorry for the confusion, let me be a little more clear about what I mean.
IOURequestStepStartPage.js
clears out the draft transaction when it's unmountedMy question is:
The problem is if we are not in start page and close the modal, is the transaction draft is cleared?
When I was originally testing it, the start page was mounted the entire time the right-hand-modal was open. It was unmounted anytime the modal was closed (tapped outside of) from any step.
Thanks for your testing. So for point 2 we can use this cleanup function to clear the draft and when we create a transaction, it will be cleared in successData. It is solved now right?
Unfortunately, there are still a few other flows where the draft collection could fill up with drafts. Primarily, if the app is killed or the tab is closed while the modal is open. This was avoidable when all the drafts used the same optimistic ID. Again, the only way I can think of cleaning those up is to have an onyx migration that cleans out drafts older than X days (maybe 30 days).
@tgolen - trying to catch up from being OOO, are you suggesting that we keep this open to find that solution or should I take this to the Open Source room for more discussion? Thank you!
I think we should keep this open and find a solution to that as part of this issue. I would like to see in incorporated into a proposal.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@alexpensify @abdulrahuman5196 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!
@alexpensify, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!
Ok, thanks, still open for proposals here
Thank you for the insight @tgolen . I agree the transaction specific optimistic transactionID is the way to go. @dukenv0307 Could you kindly incorporate the solution to clear the stale optimistic data as well after its usage in your proposal? From top of my head, I think we can try something similar to how optimistic reports work now.
Thanks, I will update soon.
Awesome, thanks @dukenv0307!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@alexpensify @abdulrahuman5196 this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!
@alexpensify, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!
@dukenv0307 any update on the refreshed proposal?
@abdulrahuman5196 Updated proposal https://github.com/Expensify/App/issues/33518#issuecomment-1868906093.
Thank you. will review today.
Reviewing now
@dukenv0307 I am not super aligned on the cleanup process mentioned in the proposal here https://github.com/Expensify/App/issues/33518#issuecomment-1868906093.
Then whenever we open the app, we will call clearOldTransactionDraft function
Maybe we can do this when we create a new transaction. Even though I am still not convinced we should do this. Seems like we are introducing a complex cleanup task for data which has very less chance of becoming stale in first place. We wouldn't want the cleanup function to run multiple times and it should run only on rare number of times.
The point mentioned by tgolen@ here could be a good fix or we can try something similar which is mentioned here https://github.com/Expensify/App/issues/33518#issuecomment-1875600148
Again, the only way I can think of cleaning those up is to have an onyx migration that cleans out drafts older than X days (maybe 30 days).
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@alexpensify @abdulrahuman5196 this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:
Thanks!
Current assignee @abdulrahuman5196 is eligible for the Internal assigner, not assigning anyone new.
@abdulrahuman5196 - thanks for reviewing on Friday, should we have a bigger discussion in the Open Source room?
@abdulrahuman5196 - thanks for reviewing on Friday, should we have a bigger discussion in the Open Source room?
We can check if @dukenv0307 has some update on the proposal. If not we can reach out.
@dukenv0307 Could you kindly respond if you have any updates.
Alright, waiting for @dukenv0307 if there is feedback. Thanks!
No update yet, waiting for feedback.
@dukenv0307 Any update here?
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: 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: Slack conversation:
Issue found when executing PR https://github.com/Expensify/App/pull/29996
Action Performed:
Expected Result:
User should be able to make a two split bills in a row in a group chat
Actual Result:
Group members disappeared in a split bill when make second split bill in a row
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/f0bb027b-ae52-42d7-ac16-1be4190e2d8d
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @abdulrahuman5196