Repository navigation
fix: Recalculate the sections only on actual change - #37341
Conversation
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| useEffect(() => setSections(sliceSections()), []); |
There was a problem hiding this comment.
I'm not 100% sure if we shouldn't just use this instead:
const [sections, setSections] = useState(sliceSections());It will uglify the ordering of the useState/useCallback in the file, but does essentially the same.
Would appreciate your thought @akinwale.
There was a problem hiding this comment.
I think I prefer useState here, since it makes the sections available for the first render, instead of right after the first render which is what happens with useEffect.
Reviewer Checklist
Screenshots/VideosAndroid: Native37341-android-native.mp4Android: mWeb Chrome37341-android-chrome.mp4iOS: Native37341-ios-native.mp4iOS: mWeb Safari37341-ios-safari.mp4MacOS: Chrome / Safari37341-web.mp4MacOS: Desktop37341-desktop.mp4 |
|
Thanks @akinwale, let me make the |
|
Re-tested the
|
neil-marcellini
left a comment
There was a problem hiding this comment.
Great, thanks so much!
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
fix: Recalculate the sections only on actual change (cherry picked from commit 8f4a3b8)
|
🚀 Cherry-picked to staging by https://github.com/puneetlath in version: 1.4.44-8 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.44-13 🚀
|
Details
Fix the bug when the first element of the OptionsSelector would be always focused on render.
Fixed Issues
$ #37238
PROPOSAL: #37238 (comment)
Tests
Same as QA
Offline tests
Same as QA
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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-compressed.mp4
Android: mWeb Chrome
chrome-compressed.mp4
iOS: Native
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-02-27.at.20.16.49-compressed.mp4
iOS: mWeb Safari
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-02-27.at.20.01.46-compressed.mp4
MacOS: Chrome / Safari
Screen.Recording.2024-02-27.at.19.59.53-compressed.mp4
MacOS: Desktop
Screen.Recording.2024-02-27.at.20.18.34-compressed.mp4