Fix mobile selection mode isn't turned off when all values are deleted#74630
Conversation
|
@ZhenjaHorbach 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] |
|
@MarioExpensify 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] |
| }, | ||
| [], | ||
| ); | ||
| useEffect(() => turnOffMobileSelectionMode, []); |
There was a problem hiding this comment.
Critical Issue: Incorrect useEffect cleanup function
This line has a bug. Currently it reads:
useEffect(() => turnOffMobileSelectionMode, []);This passes turnOffMobileSelectionMode as the cleanup function, but turnOffMobileSelectionMode doesn't return a function - it returns void. The correct syntax should be:
useEffect(() => () => turnOffMobileSelectionMode(), []);Or more explicitly:
useEffect(() => {
return () => {
turnOffMobileSelectionMode();
};
}, []);Current behavior: The effect doesn't call turnOffMobileSelectionMode at all because it's missing the function invocation ().
Expected behavior: When the component unmounts, it should call turnOffMobileSelectionMode() to turn off selection mode.
Additionally, the original code had a check if (selectionRef.current !== 0) before turning off selection mode. Removing this check means selection mode will ALWAYS be turned off on unmount, even when items are still selected. This may or may not be intentional - please verify this is the desired behavior for the fix.
There was a problem hiding this comment.
This code makes sense, but I think it’s a bit difficult to read in any case 😅
So maybe we shouldn’t use the short version?
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
trjExpensify
left a comment
There was a problem hiding this comment.
Makes sense to fix this. 👍
P.S Can you try to make your PR titles more reflective of what code changes the PR is making / fill out the explanation of changes section? Thanks!
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2025-11-10.21.17.25.movAndroid: mWeb Chrome2025-11-10.21.19.00.moviOS: HybridApp2025-11-10.21.22.08.moviOS: mWeb Safari2025-11-10.21.22.08.movMacOS: Chrome / Safari2025-11-10.21.15.21.movMacOS: Desktop2025-11-10.21.15.21.mov |
|
LGTM! |
|
🚀 Deployed to staging by https://github.com/MarioExpensify in version: 9.2.49-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/MarioExpensify in version: 9.2.49-0 🚀
|
|
🚀 Deployed to staging by https://github.com/MarioExpensify in version: 9.2.52-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.2.54-1 🚀
|
|
🚀 Deployed to staging by https://github.com/MarioExpensify in version: 9.2.52-0 🚀
|
Explanation of Change
Fixed Issues
$ #73394
PROPOSAL: #73394 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4