Repository navigation
Description
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 Not necessary, Onyx already batches updates.Onyx.batchUpdate which will do the same thing as Onyx.update, except that it won't notify subscribers until the last update is applied.
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
- [Hold #12775] Workspace - Add/removed a member offline flickers before getting disappeared when back online reported by @daraksha-dk #12743
- Web-Workspace -After renamed the workspace, you need to refresh the page to see the new name #12000
- Chat - Message sent offline change positions between each other once back online #13310
- [HOLD Onyx 266] Deleted workspace blinks in workspace list after deleting #15550
- [$4000] IOS - Timezone - Toggle switch back to online results after enabled connection #15641
- [$2000] Attachment is being displayed as the last message on LHN instead of the actual last message #16530
- Sending messages in quick sequence ends up in reshuffling the messages #13250
- [$1000] Chat - Offline sent messages with emojis added are displayed without emojis after going online #17110
- [HOLD] A message that is sent and deleted in offline mode, disappears first, then reappears then disappears again #17081
- [HOLD 15550] Settings - Workspace created and deleted while offline reappears when going back online with a different name #16776
- [Hold] Notification received for sent and deleted message in offline #17197
- [Hold 12775][$1000] Workspace avatar turn into old avatar after being removed. #16728
- [HOLD for payment][$1000] App displays older message in LHN if we send message directly after editing previous message #18102
- [Tracking] "Replay effect" when sequential actions are taken offline, and user subsequently comes online #12775
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~0110088603c45991d5
- Upwork Job ID: 1625975375525715968
- Last Price Increase: 2023-02-15
Activity
JmillsExpensify commentedon Nov 22, 2022
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 commentedon 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 commentedon Nov 22, 2022
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
planninglabel on it and circle back to it around N7.JmillsExpensify commentedon Nov 26, 2022
Nice, I'm good with that!
JmillsExpensify commentedon Nov 28, 2022
Here's another manifestation of this convo.
[-][Tracking] Pattern B Weirdness - Inviting and Removing Offline Flashes Content [/-][+][HOLD WAQ] [Tracking] Pattern B Weirdness - Inviting and Removing Offline Flashes Content [/+][-][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[/+]JmillsExpensify commentedon Dec 12, 2022
Still on hold for WAQ.
neil-marcellini commentedon Dec 20, 2022
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.
189 remaining items
aimane-chnaif commentedon May 21, 2024
C+ payment for reviewing PR is remaining
aimane-chnaif commentedon Oct 3, 2024
@JmillsExpensify or @trjExpensify can you please reopen and handle payment? Thanks
trjExpensify commentedon Oct 8, 2024
Dang, an issue from January?
Payment summary as follows:
*$500 because this is an issue created prior to the switch to $250. Offer sent.
trjExpensify commentedon Oct 17, 2024
Paid, closing!
Drop the comments that only restate the code