Avatar doesn't load when login from public room as existing user#74819
Avatar doesn't load when login from public room as existing user#74819lakchote merged 3 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| await waitForBatchedUpdates(); | ||
|
|
||
| expect(lastVisitedPath).toBe(`/${ROUTES.REPORT}/${report.reportID}`); | ||
| expect(lastVisitedPath).toBe(`/${ROUTES.HOME}`); |
There was a problem hiding this comment.
Need to update to HOME since currentUserPersonalDetails is updated when userAccountSelector changes (which happens when session?.email or userAccountID changes during sign-in). Besides, I tested the transition flow, it works fine. Please correct me if I'm wrong
There was a problem hiding this comment.
False, this led to failing tests on main, see https://expensify.slack.com/archives/C01GTK53T8Q/p1765191955953569
There was a problem hiding this comment.
It introduced flakiness, decided to revert see https://expensify.slack.com/archives/C01GTK53T8Q/p1765217642441119?thread_ts=1765217169.365099&cid=C01GTK53T8Q
|
@shubham1206agra 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] |
| ); | ||
| const [currentUserPersonalDetails = defaultCurrentUserPersonalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: userAccountSelector, canBeMissing: true}); | ||
| const [currentUserPersonalDetails = defaultCurrentUserPersonalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: userAccountSelector, canBeMissing: true}, [ | ||
| userAccountSelector, |
There was a problem hiding this comment.
❌ PERF-6 (docs)
Passing entire objects or functions as dependencies causes hooks to re-execute whenever any property changes, even unrelated ones. Specifying individual properties creates more granular dependency tracking, reducing unnecessary hook executions and improving performance predictability.
Since userAccountSelector depends on session?.email and userAccountID (line 27), the dependency array should specify these individual properties instead:
const [currentUserPersonalDetails = defaultCurrentUserPersonalDetails] = useOnyx(
ONYXKEYS.PERSONAL_DETAILS_LIST,
{selector: userAccountSelector, canBeMissing: true},
[session?.email, userAccountID]
);There was a problem hiding this comment.
@shubham1206agra I think we can keep it as we add selector as dependency as a common pattern in our codebase. Do u think so?
App/src/hooks/useTripTransactions.ts
Line 49 in a7fab59
JmillsExpensify
left a comment
There was a problem hiding this comment.
This looks fine from a product perspective, though I really don't think we should spend a lot of time on PRs involving public rooms.
Reviewer Checklist
Screenshots/VideosScreen.Recording.2025-12-06.at.9.23.15.PM.mov |
|
Reverting as it produces flakey tests, and failing tests when merging code to main. |
|
🚀 Deployed to staging by https://github.com/lakchote in version: 9.2.74-0 🚀
|
|
@lorretheboy QA team failed this PR on Android with an original issue 1765297832316.74819_Android-Fail_avatar.mp4 |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.2.74-12 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.2.74-12 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.2.74-12 🚀
|
Explanation of Change
Fixed Issues
$ #74176
PROPOSAL: #74176 (comment)
Tests
Offline tests
QA Steps
Same as Tests
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))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.mov
Android: mWeb Chrome
WEBSITE.ANDROID.mov
iOS: Native
IOS.mov
iOS: mWeb Safari
WEBSITE.IOS.mov
MacOS: Chrome / Safari
WEBSITE.mov
MacOS: Desktop
WEBSITE.IOS.mov