Skip to content

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

Closed

Description

@JmillsExpensify

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

Activity

  1. JmillsExpensify commented on Nov 22, 2022

    @JmillsExpensify
    ContributorAuthor

    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.

  2. iwiznia commented on Nov 22, 2022

    @iwiznia
    Contributor

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

  3. trjExpensify commented on Nov 22, 2022

    @trjExpensify
    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.

  4. JmillsExpensify commented on Nov 26, 2022

    @JmillsExpensify
    ContributorAuthor

    Nice, I'm good with that!

  5. JmillsExpensify commented on Nov 28, 2022

    @JmillsExpensify
    ContributorAuthor

    Here's another manifestation of this convo.

  6. 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 [/+] on Nov 28, 2022
  7. 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[/+] on Nov 28, 2022
  8. JmillsExpensify commented on Dec 12, 2022

    @JmillsExpensify
    ContributorAuthor

    Still on hold for WAQ.

  9. neil-marcellini commented on Dec 20, 2022

    @neil-marcellini
    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.

  10. 189 remaining items

  11. aimane-chnaif commented on May 21, 2024

    @aimane-chnaif
    Contributor

    C+ payment for reviewing PR is remaining

  12. aimane-chnaif commented on Oct 3, 2024

    @aimane-chnaif
    Contributor

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

  13. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed
    ReviewingHas a PR in review
    on Oct 3, 2024
  14. trjExpensify commented on Oct 8, 2024

    @trjExpensify
    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.

  15. trjExpensify commented on Oct 17, 2024

    @trjExpensify
    Contributor

    Paid, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2InternalRequires API changes or must be handled by Expensify staffNewFeatureSomething to build that is a new item.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions