-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 crash on new chat creation due to undefined sequenceNumber #2721
Conversation
src/libs/actions/Report.js
Outdated
// If we don't have a maxSequenceNumber for this report then we will assume that the report has just been created | ||
// and use 0 for the maxSequenceNumber. Otherwise, we'll have an undefined sequenceNumber in cases where no | ||
// sequenceNumber is explicitly passed. | ||
const maxSequenceNumber = !_.isUndefined(reportMaxSequenceNumbers[reportID]) |
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.
Should this be an early return instead? Just thinking that if the maxSequenceNumber
is 0
, then it doesn't really need to call setLocalLastRead()
and make an API call.
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.
Oh hmm yeah I guess that would make sense wouldn't it 😄
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.
Probably a safer change as well since my comment above could end up being wrong at some point ...
@@ -194,15 +194,15 @@ const OptionRow = ({ | |||
<View style={[styles.flexRow, styles.alignItemsCenter]}> | |||
{option.hasDraftComment && ( | |||
<View style={styles.ml2}> | |||
<Icon src={Pencil} height="16" width="16" /> | |||
<Icon src={Pencil} height={16} width={16} /> |
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.
Thanks for fixing this :D It must have been causing a propType warning? I'm ashamed I didn't notice that
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.
Oh yes forgot to mention that I fixed a few random propTypes
things in this.
Updated. |
Ahh. Dammit. I thought this was no longer happening |
All yours, @stitesExpensify! |
Gonna merge this since it's the last deploy blocker I think |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging in version: 1.0.41-0🚀
|
I verified that this worked on desktop 👍 |
Also verified this on iOS 👍 |
Android, web and mweb were a pass too 🎉 |
🚀 Deployed to production in version: 1.0.44-0🚀
|
cc @tgolen @Gonals I think this change is safe but need a second opinion. another option could be to not mark the report as "read" until the
reportMaxSequenceNumber[reportID]
exists, but that's difficult since there's no way to know this has happened because of the async Onyx callbacks etc.Details
reportMaxSequenceNumbers[reportID]
Bonus: The rest of the code changes are related to
propTypes
and thought I'd sneak them in here.Fixed Issues
Fixes #2704
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android