Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tracking] "Replay effect" when sequential actions are taken offline, and user subsequently comes online #12775

Closed
JmillsExpensify opened this issue Nov 16, 2022 · 129 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Internal Requires API changes or must be handled by Expensify staff NewFeature Something to build that is a new item.

Comments

@JmillsExpensify
Copy link

JmillsExpensify commented Nov 16, 2022

Problem

With Pattern B, offline creation events trigger a "pending" action that clears when the app comes back online. Similarly for deleting or removing content, a "strikethrough" action appears while offline and clears when the app comes back online. The pickle is that if a user takes a creation and deletion action while offline – whether that be uploading/removing an attachment, sending/deleting a message, adding/removing workspace members – content will flash or "replay" because actions in our app happen sequentially.

Here's an example of how this "replay" happens in practice:

  • User invites a workspace member offline, we show it as pending to create
  • User removes a workspace member offline, we show it as pending to delete
  • When the User comes online, we remove the row optimistically because the last action taken was to delete

However, again because of sequentiality, we see flashing in practice. The create action will run first, returning the data and showing the row. Next, the deleted action runs and we remove the row. Here's another pickle: when the creation action is run, we also send an email inviting the workspace member, but then that email is immediately invalidated. Confusing right?

tldr: When a user takes multiple write actions affecting the same Onyx key while offline and then goes back online, the actions are “replayed” which causes the UI to update unnecessarily and can cause flickering. We have already tracked 5 issues related to this problem in the App.

Solution

1. https://github.com/Expensify/Expensify/issues/270217 react-native-onyx: Create Onyx.batchUpdate which will do the same thing as Onyx.update, except that it won't notify subscribers until the last update is applied. Not necessary, Onyx already batches updates.
2. https://github.com/Expensify/Expensify/issues/270219
2.1. App: Send the Pusher socket_id with all requests.
2.2. App: [HOLD 1] While the SequentialQueue is processing, create a list of Onyx updates from each response. Once the SequentialQueue is empty, batch update Onyx.
3. https://github.com/Expensify/Expensify/issues/270220
3.1. Web-Expensify Send the Pusher socket_id with all Pusher events, preventing them from being delivered to that client.
3.2. Web-Expensify [HOLD 2] Modify our api to return all Onyx updates in the response that were pushed to the requesting accountID.

Known Issues

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0110088603c45991d5
  • Upwork Job ID: 1625975375525715968
  • Last Price Increase: 2023-02-15
Issue OwnerCurrent Issue Owner: @trjExpensify
@JmillsExpensify
Copy link
Author

I created this issue last week, but it's honestly pretty annoying to have this in the queue given all the immediate work we have in front of us elsewhere. I want to believe that we can come back to this one and remember this issue/convo, though curious for your thoughts.

@iwiznia
Copy link
Contributor

iwiznia commented Nov 22, 2022

It's a tracking issue, why does it bother you that exists? We don't have to work on it now...

@trjExpensify trjExpensify added the Planning Changes still in the thought process label Nov 22, 2022
@trjExpensify
Copy link
Contributor

Take a seat on this chaise longue, Jason. Talk to me... tell me how it makes you feel?

I'm with Ioni. I think it's fine, let's put the planning label on it and circle back to it around N7.

@JmillsExpensify
Copy link
Author

Nice, I'm good with that!

@JmillsExpensify
Copy link
Author

Here's another manifestation of this convo.

@JmillsExpensify JmillsExpensify changed the title [Tracking] Pattern B Weirdness - Inviting and Removing Offline Flashes Content [HOLD WAQ] [Tracking] Pattern B Weirdness - Inviting and Removing Offline Flashes Content Nov 28, 2022
@JmillsExpensify JmillsExpensify changed the title [HOLD WAQ] [Tracking] Pattern B Weirdness - Inviting and Removing Offline Flashes Content [HOLD WAQ] [Tracking] Pattern B Weirdness - "Replay effect" when sequential actions are taken offline, and use subsequently comes online Nov 28, 2022
@neil-marcellini neil-marcellini self-assigned this Nov 28, 2022
@JmillsExpensify
Copy link
Author

Still on hold for WAQ.

@neil-marcellini
Copy link
Contributor

I think that this issue with out of order messages when creating 2 bill splits while offline is another instance of this bug. Therefore, I'm going to hold it on this issue.

@JmillsExpensify
Copy link
Author

Added that one to our OP of known issues.

@neil-marcellini
Copy link
Contributor

Thanks! I'm actually going to have that issue closed soon, and the part where the messages are out of order will be fixed in #13310. I'll update the description to link that instead.

@JmillsExpensify
Copy link
Author

Still on hold and not something we're going to prioritize.

@melvin-bot melvin-bot bot added the Overdue label Feb 13, 2023
@trjExpensify
Copy link
Contributor

We have this held on WAQ, so that should be removed now, but do we want to progress with finding a solution to this atm though?

@melvin-bot melvin-bot bot removed the Overdue label Feb 13, 2023
@neil-marcellini
Copy link
Contributor

I vote that we start working on a fix now. It feels like a liability to have a bug in one of our most common offline patterns.

@neil-marcellini neil-marcellini changed the title [HOLD WAQ] [Tracking] Pattern B Weirdness - "Replay effect" when sequential actions are taken offline, and use subsequently comes online [Tracking] Pattern B Weirdness - "Replay effect" when sequential actions are taken offline, and use subsequently comes online Feb 13, 2023
@trjExpensify
Copy link
Contributor

I tend to agree we should figure out how we're going to plug this gap to improve the handling of adding/removing something offline. The "flashing" effect feels like a bug, though it is by design I believe, so technically it's still a New feature right?

@iwiznia
Copy link
Contributor

iwiznia commented Feb 14, 2023

though it is by design I believe, so technically it's still a New feature right?

yeah, kind of by design.

@neil-marcellini neil-marcellini added the NewFeature Something to build that is a new item. label Feb 14, 2023
Copy link

melvin-bot bot commented Jan 17, 2024

BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@roryabraham
Copy link
Contributor

@chrispader as you know the Onyx bump was reverted. Since we need to repeat that Onyx bump PR, can you please upgrade the Node version in react-native-onyx to 20.10.0 and npm to 10.2.3, then do the same in E/App?

@chrispader
Copy link
Contributor

@chrispader as you know the Onyx bump was reverted. Since we need to repeat that Onyx bump PR, can you please upgrade the Node version in react-native-onyx to 20.10.0 and npm to 10.2.3, then do the same in E/App?

yes, i can do that 👍 @roryabraham

@roryabraham
Copy link
Contributor

Merged the Node bump in Onyx

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Weekly KSv2 labels Jan 23, 2024
@trjExpensify
Copy link
Contributor

A tad out of the loop here, is payment actually due?

@roryabraham roryabraham changed the title [HOLD for payment 2024-01-24] [Tracking] "Replay effect" when sequential actions are taken offline, and user subsequently comes online [Tracking] "Replay effect" when sequential actions are taken offline, and user subsequently comes online Jan 24, 2024
@roryabraham roryabraham removed the Awaiting Payment Auto-added when associated PR is deployed to production label Jan 24, 2024
@melvin-bot melvin-bot bot removed the Weekly KSv2 label Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

This issue has not been updated in over 15 days. @iwiznia, @JmillsExpensify, @trjExpensify, @neil-marcellini, @aimane-chnaif eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Feb 19, 2024
Copy link

melvin-bot bot commented Apr 16, 2024

@iwiznia, @JmillsExpensify, @trjExpensify, @neil-marcellini, @aimane-chnaif, this Monthly task hasn't been acted upon in 6 weeks; closing.

If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

@aimane-chnaif
Copy link
Contributor

C+ payment for reviewing PR is remaining

@aimane-chnaif
Copy link
Contributor

@JmillsExpensify or @trjExpensify can you please reopen and handle payment? Thanks

@roryabraham roryabraham reopened this Oct 3, 2024
@roryabraham roryabraham added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review Not a priority labels Oct 3, 2024
@trjExpensify
Copy link
Contributor

Dang, an issue from January?

Payment summary as follows:

*$500 because this is an issue created prior to the switch to $250. Offer sent.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Monthly KSv2 labels Oct 10, 2024
@trjExpensify
Copy link
Contributor

Paid, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Internal Requires API changes or must be handled by Expensify staff NewFeature Something to build that is a new item.
Projects
None yet
Development

No branches or pull requests