-
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: Recalculate the sections only on actual change #37341
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
Thanks @akinwale, let me make the |
Re-tested the |
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.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.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 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-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