-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: turn off selection mode when unmounting #47994
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: turn off selection mode when unmounting #47994
Conversation
@dukenv0307 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] |
src/hooks/useMobileSelectionMode.ts
Outdated
} | ||
turnOffMobileSelectionMode(); | ||
}; | ||
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps |
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.
Why should we disable lint here?
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.
do we want to include the autoTurnOff flag as a dependency here?
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.
Yes
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.
fixed
@dominictb As we already had logic to trigger App/src/pages/ReportParticipantsPage.tsx Line 322 in af98a53
and other similar places. |
We can use the custom hook in SelectionListWithModal, then remove the following logic:
|
@dukenv0307 if you press back button, it will exit the selection mode first. Then press the button again -> the user will be navigated to the previous page. I think it's intentional to be like that, hence I didn't remove. |
@@ -63,7 +64,7 @@ function SelectionListWithModal<TItem extends ListItem>( | |||
} | |||
}; | |||
|
|||
useEffect(() => turnOffMobileSelectionMode(), []); | |||
useMobileSelectionMode(true); |
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.
useMobileSelectionMode(true); | |
const {selectionMode} = useMobileSelectionMode(); |
Then remove const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE);
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.
fixed
2 minor comments |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-08-30.at.10.10.21.movAndroid: mWeb ChromeScreen.Recording.2024-08-30.at.10.10.21.moviOS: NativeScreen.Recording.2024-08-30.at.10.16.27.moviOS: mWeb SafariScreen.Recording.2024-08-30.at.10.14.17.movMacOS: Chrome / SafariScreen.Recording.2024-08-30.at.10.04.59.movMacOS: DesktopScreen.Recording.2024-08-30.at.10.19.06.mov |
LGTM |
src/hooks/useMobileSelectionMode.ts
Outdated
const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE); | ||
|
||
useEffect(() => { | ||
return () => { |
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, I think we need to turnOffMobileSelectionMode when the component mount
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.
Updated
LGTM and tests well |
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.
LGTM!
✋ 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 by https://github.com/youssef-lr in version: 9.0.27-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.27-1 🚀
|
Details
Fixed Issues
$ #47685
PROPOSAL: #47685 (comment)
Tests
Verify that: Selection mode will not be shown in Tags page.
Offline tests
QA Steps
Verify that: Selection mode will not be shown in Tags page.
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
compressed_android.webm.mp4
Android: mWeb Chrome
compressed_aweb.webm.mp4
iOS: Native
ios.copy.mp4
iOS: mWeb Safari
ios.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
web.mov