Fix crash on new chat creation due to undefined sequenceNumber#2721
Conversation
| // 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.
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.
Oh hmm yeah I guess that would make sense wouldn't it 😄
There was a problem hiding this comment.
Probably a safer change as well since my comment above could end up being wrong at some point ...
| {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.
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.
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
propTypesand thought I'd sneak them in here.Fixed Issues
Fixes #2704
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android