-
Notifications
You must be signed in to change notification settings - Fork 3k
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 after leaving group as the last member #48096
Fix crash after leaving group as the last member #48096
Conversation
@rayane-djouah Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Thanks for the PR. It seems this DB comes from my previous PR that I reviewed, I'll take this one |
@@ -178,7 +178,8 @@ function ReportActionItem({ | |||
const {translate} = useLocalize(); | |||
const {shouldUseNarrowLayout} = useResponsiveLayout(); | |||
const blockedFromConcierge = useBlockedFromConcierge(); | |||
const originalReportID = useMemo(() => ReportUtils.getOriginalReportID(report.reportID, action) ?? '-1', [report.reportID, action]); | |||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | |||
const originalReportID = useMemo(() => ReportUtils.getOriginalReportID(report.reportID, action) || '-1', [report.reportID, action]); |
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.
There are few other places that we're using originalReportID ?? '-1'
, do you think we should update them as well?
App/src/libs/actions/ReportActions.ts
Line 35 in 6ca91cd
const linkedTransactionID = ReportActionUtils.getLinkedTransactionID(reportAction.reportActionID, originalReportID ?? '-1'); |
originalReportIDRef.current = originalReportID ?? '-1'; |
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.
I think it would be safe to do it, but I think it's best that we have a guideline to use || instead of ?? for string and update them all in one issue (break in several PRs perhaps).
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.
Can we just update these 2 places here? And then we can discuss about the second part later.
cc @cristipaval
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.
OR, can we update getOriginalReportID
to return undefined instead empty string?
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.
I think returning reportID || undefined
looks unclean.
I have updated to use ||
for now. We can revert it if @cristipaval disagrees
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.
Btw, I'm currently having trouble running the native app.
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.
Same here :/ I can't run native too
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.
Can we raise this for discussion somewhere?
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.
Yeah there was a thread here: https://expensify.slack.com/archives/C01GTK53T8Q/p1724842994690509
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeScreen.Recording.2024-08-27.at.22.33.49.moviOS: NativeiOS: mWeb SafariScreen.Recording.2024-08-27.at.22.28.26.movMacOS: Chrome / SafariScreen.Recording.2024-08-27.at.22.25.55.movMacOS: DesktopScreen.Recording.2024-08-27.at.22.27.21.mov |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…eaving-group Fix crash after leaving group as the last member (cherry picked from commit 9c0c647) (CP triggered by puneetlath)
@cristipaval confirmed it's fixed on staging |
🚀 Cherry-picked to staging by https://github.com/puneetlath in version: 9.0.25-7 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
Details
Leaving group chat as the last member will crash the app. This PR fixes it.
Fixed Issues
$ #48072
PROPOSAL: #48072 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4