Closed lanitochka17 closed 4 days ago
Triggered auto assignment to @greg-schroeder (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.
@greg-schroeder 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
Message and Notification Swapping in IOU When Transitioning from Offline to Online
The root cause of the problem is that the API call to update the date modifies the created
value, which subsequently rearranges the positions of report actions. This occurs because the current sorting mechanism does not prioritize report actions with pendingAction
equal to add
.
Updating the sorting logic to ensure that report actions with pendingAction
equals to 'add' are always positioned in the first of the list. This change will prevent the reordering of these actions due to API updates on the created
value if there are some pending add actions left
Add the following code here
if (first.pendingAction === 'add' && second.pendingAction !== 'add') {
return 1 * invertedMultiplier;
} else if (first.pendingAction !== 'add' && second.pendingAction === 'add') {
return -1 * invertedMultiplier;
}
Edited by proposal-police: This proposal was edited at 2024-08-08 10:23:22 UTC.
Messages and notifications swap in IOU when translated from offline to online
After we update the money request, we call saveUpdateInformation
here making the queue paused here
Then when the queue is unpaused, we merge the pending Onyx data from the response API to Onyx meanwhile other write APIs are not complete. created
from BE is larger than other report actions makes the order change.
https://github.com/Expensify/App/blob/00d2c42b4a1d53696e4cb0808ba31fc10028ffcd/src/libs/Network/SequentialQueue.ts#L179
We can remove the flushOnyxUpdatesQueue
here then we should update here to only update the Onyx data if the queue is empty because when the queue is paused, the process
promise will be resolved immediately
if (PersistedRequests.getAll().length === 0) {
flushOnyxUpdatesQueue();
}
Job added to Upwork: https://www.upwork.com/jobs/~017fdfd49bd9346b4c
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External
)
@nkdengineer
We should check if the numberOfPersistedRequests is not 0 we will not merge the Onyx update to Onyx DB when the queue is unpaused
Hmm won't this have the effect of no Onyx updates being applied until ALL of the API requests are finished? I imagine that could have alot of potential negative consequences as delay in a single request would stop all Onyx updates from other pending requests being applied.
Hmm won't this have the effect of no Onyx updates being applied until ALL of the API requests are finished?
@Ollyws Yes, currently if the queue isn't unpause, we still wait until ALL of write API are finished to merge the Onyx update here.
@nkdengineer It seems that after adding if (numberOfPersistedRequests === 0) {
that flushOnyxUpdatesQueue()
will never be called in any circumstances, or am I missing something?
@Ollyws it will be called here after all write APIs are complete.
Yes so it's effectively the same as removing flushOnyxUpdatesQueue()
from the unpause()
function, no?
@Ollyws Yeah, I think it's the same.
Hmm, it was specifically added this way in https://github.com/Expensify/App/pull/25455, although I'm not exactly sure WHY we're running flushOnyxUpdatesQueue()
before flush()
...
It seems a little redundant but perhaps I'm missing something.
Let me check this again.
@Ollyws Confirmed in Slack here. We can move forward with this solution.
@Ollyws, @greg-schroeder Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Thanks for opening a discussion, I'm just considering any adverse effects and will make a decision.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
I'm still getting essentially the same problem even with flushOnyxUpdatesQueue()
removed:
https://github.com/user-attachments/assets/665864c6-564e-4f8e-b4ac-f820d609041c
@Ollyws You're right. The problem is when the queue is paused, the process
promise is also resolved immediately
Then the onyx data is updated here while other write API areas remain in the queue. We should update to only update onyx data if the queue is empty. I tested locally with this change and it works well now. Correct me if I missed something.
if (PersistedRequests.getAll().length === 0) {
flushOnyxUpdatesQueue();
}
I updated my proposal
From @tgolen's response here, I think we should close this issue. We have many instances of the replay effect in the app, and I'm hesitant of proceeding without a holistic solution to solve them all.
My proposal can be a holistic solution to solve them all.
I talked with Tom about this one, and I think we'd both like to have the UX flashing solved, but we are definitely both concerned that this is a low-level change that carries a lot of risk. I would like to propose that in order to move forward with @nkdengineer's proposal, that we create an ad-hoc build for the PR and have QA do a full regression test on it to help ensure that everything is still working how it's expected to.
What do you think @nkdengineer and @Ollyws ?
@tgolen Yeah, look good to me.
@nkdengineer To clarify, your proposal is to remove flushOnyxUpdatesQueue()
from the unpause()
function and wrap this call of flushOnyxUpdatesQueue() in if (PersistedRequests.getAll().length === 0) {
?
Because that solution doesn't fix the issue for me.
@Ollyws Yes, this is my solution. Can you please share the video about this case?
@Ollyws @greg-schroeder 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!
@Ollyws I tested and it works well. Am I missing something?
https://github.com/user-attachments/assets/4025cdc1-9a37-4432-b8f7-aa805c94b38b
@nkdengineer it's only occuring for me on a money request with a very large amount of messages, on a new request it works fine.
it's only occuring for me on a money request with a very large amount of messages, on a new request it works fine.
@Ollyws Can you please enter @nkdengineer+s31@outlook.com
in this report and then invite this account to the report then I can test with this, thanks.
Actually I think it was a problem on my end, seems to be working fine now.
Let's move forward with @nkdengineer's proposal. πππ C+ reviewed
Triggered auto assignment to @Beamanator, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Huh, @tgolen since you added some comments and concerns about the proposal in this issue, did you want to be assigned to review as well? π€· I'm happy to, just checking before I move forward here
Sure, I wouldn't mind keeping an eye on this one. I'll swap you out
Okay, thanks @tgolen! Are you able to confirm the contributor assignment? https://github.com/Expensify/App/issues/46393#issuecomment-2283330210
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ @nkdengineer π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
OK, yeah. Getting it assigned now. Let's not forget to test this with an ad-hoc build.
PR is still in review - seems QA identified several issues that'll need to be addressed
I'm checking with Applause to have those found issues verified against staging to see if they are happening in our main branch of code. If they are reproducible in staging, we can go ahead and merge the PR. If they are not, then @nkdengineer will need to investigate them more.
It looks like the PR has been merged and deployed to production, so I think this is just waiting on the regression period and payments @greg-schroeder.
Ah, I guess it didn't get picked up by the automation. π€
Regression period end 2024-09-10
Payment summary:
Contributor: @nkdengineer - $250 - Paid via Upwork C+: @Ollyws - $250 - You can make a manual request via ND for the reviewer role
Requested in ND.
$250 approved for @Ollyws
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.13-3 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): betlihemasfaw14@gmail.com Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Messages and notifications should remain in place
Actual Result:
Messages and notifications swap in IOU when translated from offline to online
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/94716cba-2baf-4928-b738-f1aa03d54c9f
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @greg-schroeder