Repository navigation
Read the Concierge chat on press instead of subscribing to it in render - #104242
Conversation
|
@MelvinBot review |
Review: LGTM ✅I found no bugs. The change is safe: in both screens, Two small notes on the PR description (not the code):
How I traced it
|
bf9e028 to
4a85b3f
Compare
|
@MelvinBot Deep review |
Deep review: one bug to fix
|
|
@MelvinBot Deep review |
Deep review (follow-up): LGTM ✅The Submit guard fix is correct, and the new commits add no new problems. CI passes, except for the independent-approval check and the perf tests that are still running. Guard fix: So the one-shot flag is consumed before its reset microtask can run. One suggestion (non-blocking): add a test for the guard. No test covers
These notes from my earlier review still apply:
What I checked in the new commits
|
47100b0 to
18a5520
Compare
|
@MelvinBot Deep review |
|
@MelvinBot test |
Deep review (3 new commits): LGTM ✅I found no bugs in What I verified:
Non-blocking notes:
|
|
🤖 Web test steps verification results: Pay, cancel payment, bulk pay, Submit dismissal, expense-thread opening, the carousel and the self DM flows each ran their action exactly once, with no duplicates. The delegate check, both Cmd/Ctrl-click new-tab checks and the reload check were not run, because the web tester can't use a second account, control tabs or reload the session. The held-expense Pay check is partial: the hold was already handled at approval, so the Pay-time hold menu was not exercised.
|
|
@MelvinBot mobile test |
…concierge-report-subscriptions-perf-v1
|
Please fix Oxlint |
|
@mkhutornyi I'm working on answers to your review and fixing oxlint issues, I will ping you when ready 👍 Thanks! |
Widening ResumePayload to accept async retries made retry?.() return a promise in the two callers without a param annotation, tripping no-misused-promises. Annotate the param as () => void, matching MoneyReportHeaderSecondaryActions.
…concierge-report-subscriptions-perf-v1 # Conflicts: # src/hooks/useSearchBulkActions.ts
…ename the submit guard
|
@mkhutornyi Ready |
|
🤖 Web test steps verification results: I found no regressions on web: Submit, Approve, Pay > Mark as paid, Cancel payment, bulk Approve, expense-thread opens and the Concierge side panel each ran once on the first click, with no freeze or wrong navigation. Explain and Latest messages could not be set up in this account. A code review of the latest commits also found no confirmed regressions; one path needs a manual Safari check: Cmd-click on a Search expense with no thread now calls
|
|
@LukasMod In the future, please break these PRs down into smaller pieces. It would really be best to fix one location at a time in separate PRs. This makes it easier to test, review, and has smaller chance of regressions. |
1 similar comment
|
@LukasMod In the future, please break these PRs down into smaller pieces. It would really be best to fix one location at a time in separate PRs. This makes it easier to test, review, and has smaller chance of regressions. |
mountiny
left a comment
There was a problem hiding this comment.
(Vit's agent) No blockers from me. I left two NAB nits inline.
What I checked and found safe:
Onyx.getandmultiGetin 3.0.121 read only from the cache, so each newawaitwaits a few microtasks and never reads storage.- The Submit popover guard runs before the first await, and the new hook test locks that in.
- In the one-expense report path, the
.thenthat creates the thread runs before therequestAnimationFramenavigation. useVerifyAccountAndResumereplays the Pay handler from an effect after validation. That matches the wording of ONYX-1 C1, but it only finishes the user's own press, once, and it reads the values from after validation.
| bankAccountList: OnyxEntry<BankAccountList>; | ||
| }; | ||
|
|
||
| function doesSearchActionUsePressTimeInputs(action: SearchTransactionAction | undefined) { |
There was a problem hiding this comment.
(Vit's agent) NAB: this gate has to stay in sync with the switch in handleActionButtonPress by hand. If a later branch starts to use conciergeChat, introSelected, amountOwed or bankAccountList, that branch gets undefined, and TypeScript won't catch it. A one-line comment on the switch that points here would help. Or add Pay and Approve cases to useSearchActionPressTest, which covers only Submit and View now.
| if (shouldOpenTransactionThread && !shouldOpenTransactionThreadInNewTab) { | ||
| seedCarouselForOpenedExpense(); | ||
| } | ||
| const conciergeChat = await readConciergeChat(); |
There was a problem hiding this comment.
(Vit's agent) NAB: Cmd-click on a Spend > Expenses row whose thread was never opened is the one flow where window.open now runs after an await. I think it still works: Onyx.get resolves from the cache in microtasks, so preventDefault and window.open run before the click finishes dispatching. But the QA steps test Cmd-click on a report row, which you note is untouched. Could you add this case to the QA steps for Chrome and Safari?
There was a problem hiding this comment.
I added Test 3 in QA section
|
I 100% agree with splitting this up in future |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
Sure, next PRs will be much smaller 🤞 |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.32-0 🚀
|
|
No FullStory changes needed. This PR refactors existing data reads to reduce unnecessary re-renders without adding screens, controls, user properties, or newly exposed private data. |
|
No help site update needed — this PR improves performance by changing when the app reads data, without changing user workflows, labels, feature availability, or documented behavior. |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.5.32-7 🚀
|



















Explanation of Change
Several components subscribed to the whole Concierge chat report only to pass it to a function when the user pressed something: open a report, pay, tap Explain, create an expense thread. Every update to the Concierge chat re-rendered all of them. You can see it when you chat with Concierge in the side panel while an expense chat or the Spend page is open next to it.
This PR removes those subscriptions. Each handler reads the Concierge chat with
Onyx.getat press time, and reads the other press-only values (intro and onboarding data, rules, billing values, bank accounts) in oneOnyx.multiGet. The Search page and the report preview do the same, so neither subscribes to the Concierge chat or its ID any more. The press-only values left the Search payment context for one reader, and the three Search rows share one hook,useSearchActionPress, which runs the submit popover intercept, reads the inputs for Submit, and hands them to the press handler. View and the other row actions go through the same hook without a read. Users see no difference. The screens stop re-rendering when the Concierge chat updates.Onyx.geton the Concierge chat is the live read thatno-onyx-get-snapshot-keyallows on purpose. Inside Search > Chats rows it replaces a snapshot-scopeduseOnyxvalue that was empty.The handlers are async now and follow the app's convention for async handlers: no try/catch, a rejection goes to Sentry and the web
unhandledrejectionlogger.Onyx.getnever rejects. It logs storage failures and resolves.Measured against
mainon one account before the review fixes (web wide layout with CPU throttling, and an iOS simulator):Fixed Issues
$ #105712
PROPOSAL:
Tests
The PR changes press handlers only. In every test watch for the action happening once (no double payment, thread or comment), navigation landing where it did on main, and nothing visibly waiting after the press. Web = Chrome wide layout, iOS = iPhone.
Test 1: Pay from the expense report header (web, iOS)
Test 2: Pay from the report preview (web)
Test 3: Pay from a Spend > Reports row (web)
Test 4: Bulk Pay (web)
Test 5: Submit from a Spend row (web)
Workspace have to be on Submit plan
Test 6: Report preview with several expenses (web, iOS)
Test 7: Tracked expense with no thread (web, iOS)
Test 8: Explain link (web, iOS)
Test 9: Live tail (web, iOS)
Test 10: Side panel send (web)
Offline tests
QA Steps
Same as tests
Same as tests + 2 tests more related to diff browsers. Check on Chrome and Safari.
Test 1: Cmd-click a report row (Chrome and Safari)
Why: report rows take a different branch that was not touched; included so the two paths cannot be confused when reporting a result.
Test 2: Cmd-click while a popover is open (Chrome and Safari)
Why: the removed
stopPropagationwas the only line that could change what an open popover sees from this click.Test 3: Cmd-click an expense whose thread was never opened (Chrome and Safari)
Why: the only Cmd-click where the new tab opens after an awaited Onyx read; report rows and expenses with a thread never await before opening the tab.
Prerequisite: Spend > Expenses with an expense created outside NewDot (Classic, emailed receipt or card import), in a report that has two or more expenses, never opened in NewDot.
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))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.Screenshots/Videos
Android: Native
android.mov
Android: mWeb Chrome
android.web.mov
iOS: Native
ios.mov
iOS: mWeb Safari
android.web.mov
MacOS: Chrome / Safari
Test 1-3
web-1-3.mov
Test 4
web-4.mov
Test 5
web-5.mov
Test 6-10
web-6-10.mov
Test 10 and offline
web.10b.offline.mov