[Payment due @mkhutornyi] Fix empty Account Manager banner#88611
[Payment due @mkhutornyi] Fix empty Account Manager banner#88611
Conversation
|
@stitesExpensify 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 [accountManagerReportID] = useOnyx(ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID); | ||
| const [accountManagerReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(accountManagerReportID)}`); | ||
| const accountManagerAccountID = getParticipantsAccountIDsForDisplay(accountManagerReport, false, true)?.at(0) ?? CONST.DEFAULT_MISSING_ID; | ||
| const [account] = useOnyx(ONYXKEYS.ACCOUNT); |
There was a problem hiding this comment.
❌ PERF-11 (docs)
Subscribing to the full ONYXKEYS.ACCOUNT object when only accountManagerReportID and accountManagerAccountID are needed causes unnecessary re-renders whenever any unrelated field on the account changes. This is also inconsistent with AccountManagerLinkRenderer.tsx in this same PR, which correctly uses a selector for the same data.
Use a selector to extract only the needed fields:
const [accountManagerData] = useOnyx(ONYXKEYS.ACCOUNT, {
selector: (account) => ({
accountManagerReportID: account?.accountManagerReportID,
accountManagerAccountID: account?.accountManagerAccountID,
}),
});
const accountManagerReportID = accountManagerData?.accountManagerReportID;
const accountManagerAccountID = Number(accountManagerData?.accountManagerAccountID ?? CONST.DEFAULT_MISSING_ID);Reviewed at: f68db34 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot please review |
|
Code Review — PR #88611 The approach is sound: reading Issues
Tests
VerdictThe change is correct and well-tested. One minor nit: confirm that the Overall: Looks good ✅ |
|
Confirmed intentional. src/selectors/PersonalDetails.ts:5 defines: const personalDetailsSelector = (accountID: number) => ...The selector takes a |
|
Let's get a c+ on this as well though! |
|
I'd like to review this as C+ |
flaviadefaria
left a comment
There was a problem hiding this comment.
This fix makes sense to me from a product standpoint 👍
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.movAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.mov |
mkhutornyi
left a comment
There was a problem hiding this comment.
QA Steps is missing. Otherwise looks good.
| const {translate} = useLocalize(); | ||
| const expensifyIcons = useMemoizedLazyExpensifyIcons(['Lightbulb']); | ||
| const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(reportID)}`); | ||
| const [accountManagerReportID] = useOnyx(ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID); |
There was a problem hiding this comment.
NAB: ACCOUNT_MANAGER_REPORT_ID is not used anymore.
Should we completely remove this key from ONYXKEYS list?
|
🎯 @mkhutornyi, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
🚧 @Valforte has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ 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/Valforte in version: 9.3.62-13 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes required. This PR is a purely internal bug fix — it changes which Onyx key the Account Manager banner reads from ( I checked all 12 help site articles under |
|
🚀 Deployed to staging by https://github.com/Valforte in version: 9.3.63-1 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes required. This PR is a bug fix for a race condition — it changes the internal data source for I reviewed all 61 help articles that reference "Account Manager" — they describe the Account Manager as a support contact role (e.g., "reach out to your Account Manager or Concierge"). None document the banner UI component or its rendering behavior, so no updates are needed. |
|
🚀 Deployed to staging by https://github.com/Valforte in version: 9.3.64-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes required. This PR is an internal bug fix — it changes the Onyx data source for I searched all articles under |
|
Hi @Valforte. Can you please clarify how to create a workspace with an Account Manager? |

Explanation of Change
Fix the empty Account Manager banner by getting the accountManagerAccountID from the
accountOnyx key, which is always filled byOpenAppandReconnectApp, thus avoiding a race condiction when the Account Manager Report hasn't been yet loaded into Onyx.While at it fixed the same problem in AccountManagerLinkRenderer and WorkspaceWorkflowsPage
Fixed Issues
#88539
PROPOSAL:
Tests
On a workspace with an Account Manager
Offline tests
QA Steps
On a workspace with an Account Manager
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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./** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari