-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix flashing messages on iOS #2252
Fix flashing messages on iOS #2252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small comments with lots of explanation (sorry) - let me know if you agree / disagree / have questions!
@@ -373,7 +373,7 @@ class ReportActionsView extends React.Component { | |||
renderItem={this.renderItem} | |||
CellRendererComponent={this.renderCell} | |||
contentContainerStyle={[styles.chatContentScrollView]} | |||
keyExtractor={item => `${item.action.sequenceNumber}`} | |||
keyExtractor={item => `${item.action.timestamp}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, this isn't actually going to work out. It turns out, it's quite easy to hit a problem if you send messages quickly (more than one per second), since moment().unix()
(the code creating this timestamp, in src/libs/actions/Report.js
) easily becomes non-unique.
Instead, I'm thinking we can change this to item.action.clientID
since this comes from optimisticReportActionID
in Report.js
, which is created with Date.now()
(more digits than moment().unix()
plus a random number (see https://github.com/Expensify/Expensify.cash/pull/1394/files where this was added).
From my investigation, this does still a slight issue where .clientID
doesn't exist when initially merging the new action into Onyx (in Report.js -> addAction
) since we don't set clientID
there -> clientID
is added in the server code later, which is how it comes back to the front-end code.
To fix this, I think we can just add clientID: optimisticReportActionID,
when updating Onyx locally. Please let me know your thoughts on this 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah it seems to work with clientID
as well. updating the pr
Hmm not sure if I'm running into a weird caching issue, but I can't seem to reproduce the "flashing" on latest master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@Maftalion Me either - I also tested master on my physical android device (which i hadn't done while testing your changes before) and I don't experience the flashing either... I'm going to ask a few co-workers to check as well I wonder if it's the recent Onyx upgrades that fixed this 🤔 or something related to |
Alright it looks like we're good to close this, no changes needed since the error isn't occurring on the latest version (dev, not production) - tested by you & me + a few of my colleagues |
@Beamanator it looks like these changes still get rid of the "flashing" that reappeared. There is some new complexity with the IOU items, they don't come with a Also would still need the change to |
Hey @Maftalion sorry for the delay! I like the idea of falling back to
Yes please create another issue for this 👍 |
Can confirm that the screen no longer flashes, but now we have a different behavior: newly-typed text appears in the chat history, then the entire chat history shifts down about half the font height: |
Neither behavior is happening in the |
I'm also not getting any flashing in the |
The flashing is still happening on staging v1.0.37-0 (iOS). Here's another screen recording from today to confirm. Image.from.iOS.2.MP4Also, looks like another issue for this was created last night, so I've closed that dupe to focus our efforts here: #2693 |
Hookay! I spent WAY too much time getting myself setup to test this on a physical device and then building several branches to test if the bug IS definitely still there in 1.0.37-0 (and -1), as well as in the And while @Maftalion's branch does get rid of the flashing, it introduces a regression that I'll call the Donky Kong Effect that makes the chat history shudder like there's a large gorilla stomping at the top: As such, testing on a physical device is required, and no regressions should be included. |
@deetergp does this mean it's only reproducible on a physical device? also I refer to the regression issue as "bouncing" above but totally like your terminology better 😆 . It can be fixed by updating |
@Maftalion It may well only be reproducible on a physical device--all the times I tried testing any branch in the simulator, I haven't seen the flashing occur, and your branch definitely makes it go away.
Ahh, that's what that was about. Has that fix already been merged into the |
Hey guys, yeah that is probably my bad - I thought the |
Awesome, sounds good! Just pushed up that change @Beamanator @deetergp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass and code looks good! Thanks for sticking with it 👍
RPReplay_Final1620669015.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to do this to you, but can you merge master here & fix the merge conflict before I test? :D
# Conflicts: # src/pages/home/report/ReportActionsView.js
@Beamanator fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-tested and it still works like a champ. Code looks good so let's get this merged ASAP, before more conflicts pop up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well for me too! LGTM :D
Thanks @deetergp & @Maftalion !
🚀 Deployed to staging in version: 1.0.42-5🚀
|
🚀 Deployed to production in version: 1.0.44-0🚀
|
Details
Fixed Issues
Fixes #2205
Tests
QA Steps
Tested On
Screenshots
Web
Screen.Recording.2021-04-05.at.12.44.36.PM.mov
Mobile Web
Screen.Recording.2021-04-05.at.12.49.42.PM.mov
Desktop
Screen.Recording.2021-04-05.at.12.50.51.PM.mov
iOS
Screen.Recording.2021-04-02.at.3.57.13.PM.mov
Android
Screen.Recording.2021-04-06.at.5.35.52.PM.mov