Update report option when personal detail is changed#40167
Update report option when personal detail is changed#40167bondydaa merged 11 commits intoExpensify:mainfrom
Conversation
|
@hungvu193 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] |
|
Precondition: Create a brand new account. Screen.Recording.2024-04-17.at.09.37.24.mov |
|
@hungvu193 Updated to fix this case. |
| }); | ||
|
|
||
| const personalDetails = usePersonalDetails(); | ||
| const prevPersonalDetails = useRef(personalDetails); |
There was a problem hiding this comment.
can we replace this by our existing hook usePrevious?
There was a problem hiding this comment.
@hungvu193 I tested and we can use usePrevious hook. Updated to use this hook.
There was a problem hiding this comment.
Awesome, let's me test again!
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid.movAndroid: mWeb ChromemWebAndroid.moviOS: NativeIOS.moviOS: mWeb SafarimSafari.movMacOS: Chrome / SafariChrome.movMacOS: Desktopdesktop.mov |
| return newOptions; | ||
| }); | ||
|
|
||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
what other dependencies is this expecting that we're purposefully ignoring? it looks reports?
There was a problem hiding this comment.
@nkdengineer can you help me understand why we added this?
There was a problem hiding this comment.
@bondydaa In this case we only want to update the personal detail option and the related report of the changed personal detail. So we're ignoring other dependencies.
There was a problem hiding this comment.
got it, can you add that as a comment here then as well so future us can know exactly why/which dependencies we are okay with ignoring?
There was a problem hiding this comment.
@bondydaa I added a comment, please help to check again.
cc @hungvu193
|
@bondydaa Any update here. |
bondydaa
left a comment
There was a problem hiding this comment.
sorry went OOO last week, 👍
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 1.4.67-7 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to staging by https://github.com/bondydaa in version: 1.4.68-0 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 1.4.67-7 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
| newReportOption: OptionsListUtils.SearchOption<Report>; | ||
| }> = []; | ||
|
|
||
| Object.keys(personalDetails).forEach((accoutID) => { |
There was a problem hiding this comment.
Heads up, this caused the regression #41275
(Also, accountID 😄)
There was a problem hiding this comment.
Thanks for handling it while I'm AFK, that's weird that I already tested logged out case but couldn't see the crash.
I should have tested it more careful next time!
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.4.68-3 🚀
|
| Object.keys(personalDetails).forEach((accoutID) => { | ||
| const prevPersonalDetail = prevPersonalDetails?.[accoutID]; | ||
| const personalDetail = personalDetails?.[accoutID]; | ||
|
|
||
| if (isEqualPersonalDetail(prevPersonalDetail, personalDetail)) { | ||
| return; | ||
| } | ||
|
|
||
| Object.values(reports ?? {}) | ||
| .filter((report) => Boolean(report?.participantAccountIDs?.includes(Number(accoutID))) || (ReportUtils.isSelfDM(report) && report?.ownerAccountID === Number(accoutID))) | ||
| .forEach((report) => { | ||
| if (!report) { | ||
| return; | ||
| } | ||
| const newReportOption = OptionsListUtils.createOptionFromReport(report, personalDetails); | ||
| const replaceIndex = options.reports.findIndex((option) => option.reportID === report.reportID); | ||
| newReportOptions.push({ | ||
| newReportOption, | ||
| replaceIndex, | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
This is quite expensive and had a bad performance when we had to do it for all reports/ first render on a fresh login. #54050
Details
Update report option when personal detail is changed
Fixed Issues
$ #39607
PROPOSAL: #39607 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.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
Screen.Recording.2024-04-16.at.15.52.13.mov
Android: mWeb Chrome
Screen.Recording.2024-04-16.at.15.51.43.mov
iOS: Native
Screen.Recording.2024-04-16.at.15.52.50.mov
iOS: mWeb Safari
Screen.Recording.2024-04-16.at.15.51.00.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-16.at.15.50.16.mov
MacOS: Desktop
Screen.Recording.2024-04-16.at.15.54.06.mov