-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
chore: migrate AuthScreens from withOnyx to useOnyx #49185
chore: migrate AuthScreens from withOnyx to useOnyx #49185
Conversation
@arosiclair 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] |
The central pane is missing on logging in. I think this is because centraPaneLoading.mp4I think we need to get the loading status from
|
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.
The central pane is missing on logging in. I think this is because useOnyx
does not wait till data is loaded.
centraPaneLoading.mp4
I think we need to get the loading status from useOnyx
.
The useOnyx() hook won't delay the rendering of the component using it while the key/entity is being fetched and passed to the component. However, you can simulate this behavior by checking if the status of the hook's result metadata is loading. When status is loading it means that the Onyx data is being loaded into cache and thus is not immediately available, while loaded means that the data is already loaded and available to be consumed.
Screen.Recording.2024-09-16.at.8.35.03.AM.mov |
Can you please fix the unit tests also? |
const [session, sessionStatus] = useOnyx(ONYXKEYS.SESSION); | ||
const [lastOpenedPublicRoomID, lastOpenedPublicRoomIDStatus] = useOnyx(ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID); | ||
const [initialLastUpdateIDAppliedToClient, initialLastUpdateIDAppliedToClientStatus] = useOnyx(ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT); | ||
const isSessionLoading = isLoadingOnyxValue(sessionStatus, lastOpenedPublicRoomIDStatus, initialLastUpdateIDAppliedToClientStatus); |
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.
const isSessionLoading = isLoadingOnyxValue(sessionStatus, lastOpenedPublicRoomIDStatus, initialLastUpdateIDAppliedToClientStatus); |
@@ -390,6 +384,9 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie | |||
// Prevent unnecessary scrolling | |||
cardStyle: styles.cardStyleNavigator, | |||
}; | |||
if (isSessionLoading) { |
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.
if (isSessionLoading) { | |
if (isLoadingOnyxValue(sessionStatus, lastOpenedPublicRoomIDStatus, initialLastUpdateIDAppliedToClientStatus)) { |
key: ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, | ||
}, | ||
})(AuthScreensMemoized); | ||
export default AuthScreensMemoized; |
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.
export default AuthScreensMemoized; | |
export default memo(AuthScreens, () => true); |
Still working on fixing the test cases |
…til/App into 49103-onyx-migration
Fixed tests. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeauthAndroid.mp4Android: mWeb ChromeauthAndroidmWeb.mp4iOS: NativeauthiOS.mp4iOS: mWeb SafariauthiOSmWeb.mp4MacOS: Chrome / SafariauthChrome.mp4MacOS: DesktopauthDesktop.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!
✋ 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/roryabraham in version: 9.0.41-0 🚀
|
@roryabraham @c3024 Any specific steps to be verified in QA section? |
Not really. Just regression tests should cover this |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
FYI, introduced a regression. |
I also found another regression connected to this migration 😢 Go to
|
PR was reverted here |
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.41-10 🚀
|
Details
This is migration task, we are removing
withOnyx
and useuseOnyx
forAuthScreen
component.Fixed Issues
$ #49103
PROPOSAL: #49103 (comment)
Tests
Offline tests
same as above
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
Screen.Recording.2024-09-13.at.11.50.46.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-09-13.at.11.54.20.PM.mov
iOS: Native
Screen.Recording.2024-09-13.at.11.28.49.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-09-13.at.11.30.27.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-09-13.at.11.56.30.PM.mov
MacOS: Desktop
Screen.Recording.2024-09-13.at.11.57.11.PM.mov