Skip to content

Perf/spend filters hover - #97697

Merged
roryabraham merged 33 commits into
Expensify:mainfrom
software-mansion-labs:perf/spend-filters-hover
Sep 10, 2026
Merged

roryabraham merged 33 commits into
Expensify:mainfrom
software-mansion-labs:perf/spend-filters-hover

Conversation

@sumo-slonik

@sumo-slonik sumo-slonik commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

What was wrong

Every hover over a filter row remounted the whole content pane - one pane was rendered at a time, keyed by the filter it showed, so moving to another filter swapped it - and the people filters (From, To, Attendee, Assignee) rebuilt the entire personal detail option list from scratch on every mount: several full O(n) passes over the personalDetailsList collection (building options, filtering, sorting, cloning). On accounts with a large number of contacts this blocked the JS thread for hundreds of milliseconds per hover, so sweeping the cursor down the filter list froze the popover and the highlight lagged several rows behind the cursor.

What this PR changes

  1. Hover intent on the contact list only: pointing at a filter row shows that filter straight away, at any cursor speed. What waits for the cursor to come to rest is not the pane but the one derivation heavy enough to be felt: building the contact list, which only the four filters routed to UserSelector read (From, To, Attendee, Assignee). They mount at once and stand as their own spinner until the cursor rests for SEARCH_FILTER_HOVER_INTENT_DELAY (30 ms), and every other filter renders with no wait. Time spent on a row cannot tell a deliberate hover from a slow pass over the list, but coming to rest can. Movement smaller than HOVER_INTENT_REST_RADIUS_PX still counts as resting so a shaky hand is not held back, leaving the list releases whatever the row it ended on was withholding, and keyboard focus withholds nothing.

  2. Keeping visited panes mounted: the content of a filter stays mounted once visited, so returning to it costs nothing. A backgrounded pane is hidden with <Activity mode="hidden"> instead of being unmounted, so it keeps the list it has already built and holds no Onyx subscriptions while hidden. Panes are mounted lazily and only live while the popover is open. A hidden pane goes on rendering with the values it was rendering with when it was last shown, so moving between filters does not re-render it. Separately, the values an instance was built from are what a revisit is compared against: a pane whose values moved on since it was built is remounted rather than revealed, because a content decides its selection pinning on mount. Only the values that content reads count, so a change to a filter it does not read leaves it alone.

  3. Memoizing the derivations behind the people filters: createOptionList in usePersonalDetailOptions, and getValidOptions plus the selected-state mapping in usePersonalDetailSearchSelector, are pure derivations of Onyx data, so they are memoized at module level and survive a remount. They use a new equivalentArgsComparator exported from @libs/memoize, which compares memoization keys argument by argument: shallowly first, and one level deeper for plain objects that are rebuilt on every call from unchanged sources (e.g. a mapped Onyx collection). usePersonalDetailOptions also skips its whole derivation chain while it is loading or disabled. Because those caches live at module level, useReleaseOptionListCaches drops them once another tab takes over from Search, so the lists are not pinned in memory beyond the screen that wanted them - tens of megabytes on an account with a large contact list.

  4. A revealed pane looks like the one that was built, not the one that was left: keeping a pane mounted also keeps what you did in it, and a search term you typed and a place you scrolled to are not worth keeping - coming back to a filter should offer the whole list again. A hidden <Activity> subtree keeps its state but unmounts its effects, so a list runs its mount effect again when it is revealed and its cleanup runs as it is hidden. What was typed is dropped as the pane is hidden, so the debounce behind the input elapses while nobody is looking at it rather than in front of the eyes it is next revealed to. The list itself is replaced rather than scrolled: its container loses the scroll position while hidden while the recycler still reports the offset it was left at, which is what leaves the visible area blank, and a recycler takes an offset only from a scroll event, so scrolling to a top it already sits at produces none. A fresh recycler starts where its container already is. This lives in useRevealedListReset and is used by both BaseSelectionList and BaseSelectionListWithSections, so every filter pane is covered; a list left at the top is revealed untouched, and dropping the search term is opt-in per consumer. Selecting in a pane is the one thing a revisit keeps, because that pane is rebuilt anyway (see 2), which is what floats the selected rows to the top.

  5. A spinner rather than a row skeleton while a contact list is not being built yet, held at the height a contact list occupies so what arrives does not push the panel open under the cursor. A skeleton would draw a list that is not there and flicker row by row as the cursor moves between filters. This also changes the full-screen filter page on native, which passes ready={didScreenTransitionEnd} and previously showed the skeleton during the screen transition.

Measurements

Chrome, dev build, an account seeded with 106k personal details, on a 1440x900 viewport where the popover offers 14 filter rows. The metric is the total longtask duration - how long the JS thread was blocked - summed over a phase. Variants were interleaved rather than measured in blocks, n=5 per variant, and each run reads its own variant back from the bundle, so a run cannot be attributed to a tree that was not rebuilt.

One run walks five phases: a fast sweep over every row (15 ms per row, three passes each way), a slow sweep where every row is dwelled on long enough to activate it (60 ms per row, three passes each way), a tour resting 500 ms on each row, alternating between From and To four times, and a detour of From -> merchant -> date -> amount three times over, ending back on From.

phase main mean (sd) this PR mean (sd) change
fast sweep ¹ 5485 ms (523) 17 ms (38) -100%
slow sweep 5377 ms (514) 1029 ms (49) -81%
rest tour 909 ms (61) 65 ms (8) -93%
revisit 3326 ms (315) 42 ms (69) -99%
detour 1689 ms (139) 0 ms (0) -100%
whole run ¹ 16786 ms (1517) 1153 ms (119) -93%
longest single task 605 ms (51) 526 ms (16) -13%

¹ Measured on an earlier revision where the pane itself waited for the cursor to rest, so a fast sweep rendered nothing at all. The current one renders every filter as the cursor reaches it, which puts back the work of mounting the panes a sweep passes over, so these two are a floor rather than what it does. The other phases all dwell long enough to activate a row either way.

Every phase separates cleanly, with disjoint ranges across runs, except the longest single task, where the ranges overlap. That is the honest limit of this change: the popover stops doing the same work over and over, but building the option list for 106k contacts once is still a single synchronous pass, and that pass is what the longest task measures. Splitting it up is a separate change.

Where each mechanism shows up: withholding the contact list is what the fast and slow sweeps measure, keeping panes mounted takes the revisit and the detour to zero, and the memoized derivations are what make the mounts that remain cheap - measured separately at -46% for createOptionList and a further -23% for getValidOptions plus the selected-state mapping.

Why Activity rather than hiding a backgrounded pane with a style. Both variants measured on the same base, one run per branch checkout, strictly interleaved, n=5 per variant, on an account with 106k personal details.

scenario metric visibility: hidden Activity
8 personalDetailsList updates while the popover is open, two heavy panes mounted longest single blocking task 2395 ms 1581 ms (-34%)
same wall time for the whole sequence of 8 updates 23.4 s 20.6 s (-12%)
sweep + rest + revisit, static data blocked JS over the run 1121 ms 1237 ms (+10%)

The first two separate cleanly (disjoint ranges across runs, tight spread); the third one's ranges overlap, so read it as a cost of up to ~10% on the static case rather than a measured number. Activity does not reduce the total work under churn - 18.4 s vs 18.7 s of blocked JS summed, indistinguishable - it splits it into 24 tasks instead of 9, and that is what moves the worst blocking task.

Worth flagging separately: those eight personal detail updates block ~18 s of JS in both variants. Neither approach reduces that, one only slices it differently, and it needs its own fix.

Absolute values are inflated by the dev build; the ordering and the ratios are the part to trust.

Before / after comparison

performance.filters.mp4

Fixed Issues

$ #97455

Tests

Best tested on an account with a large number of contacts (e.g. a High Traffic account), where the freeze was clearly visible before this change.

  1. Open the advanced filters popover on the Reports page (the Filters button next to the search field) on web with a wide layout.
  2. Quickly sweep the cursor up and down the filter list without stopping, and verify each row's content appears as the cursor reaches it, the people filters (From, To, Attendee, Assignee) show a spinner rather than a contact list, and the popover does not freeze.
  3. Rest the cursor on From and verify its contact list appears right after the cursor stops.
  4. Type a few characters into the search input of the From pane, hover over To, then move back to From, and verify the From pane shows up instantly (no spinner) with the search input empty and the whole contact list back.
  5. Select one or two users in the From pane and verify the selection is applied to the search query, and that the rows stay where they are rather than jumping to the top under the cursor.
  6. Hover over To, move back to From, and verify the pane is rebuilt with the users selected in step 5 now at the top of the list.
  7. Close the popover, reopen it and hover over From again, and verify the list is correct and reflects the selection made in step 5.
  8. Walk the filter list with the keyboard (Tab / arrow keys) and verify the content pane follows the focused row with no spinner, since focus never passes over rows on the way.
  9. Scroll down the Category list (or any other filter with a long list), hover over another filter, then move back to it, and verify the list comes back at the top, with rows drawn rather than a blank area.
  10. Repeat steps 4 and 9 on Workspace (and on Card or Bank account if the account has them), which are built on a different list component, and verify they behave the same.
  • Verify that no errors appear in the JS console

Offline tests

Unnecessary - this is a rendering performance change only, no network interaction is affected.

QA Steps

Same as Tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

@codecov

codecov Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 91.22% <ø> (ø)
...omponents/Search/FilterComponents/UserSelector.tsx 68.18% <100.00%> (ø)
...ents/SelectionList/hooks/useSelectionListScroll.ts 90.00% <100.00%> (ø)
src/hooks/useDebounce.ts 100.00% <100.00%> (ø)
src/hooks/useIsScrollLikelyLayoutTriggered.ts 100.00% <100.00%> (ø)
src/hooks/usePointerMovement.ts 100.00% <100.00%> (ø)
src/hooks/useReleaseOptionListCaches.ts 100.00% <100.00%> (ø)
src/libs/memoize/index.ts 81.66% <100.00%> (+4.58%) ⬆️
src/pages/Search/SearchPage.tsx 90.00% <ø> (ø)
...box/report/ReportActionCompose/SuggestionEmoji.tsx 73.40% <ø> (ø)
... and 11 more
... and 11 files with indirect coverage changes

@sumo-slonik
sumo-slonik force-pushed the perf/spend-filters-hover branch 9 times, most recently from 51bb726 to 49096a3 Compare August 7, 2026 10:49
Hovering a filter row in the Search filters popover remounted its whole
content and rebuilt the option lists from scratch, which blocked the main
thread for over a second per row on accounts with large personal details.

- Switch the content pane to a debounced rested filter, so sweeping the
  cursor across rows moves only the highlight.
- Keep the last three rested filter contents mounted inside <Activity>,
  so returning to one toggles visibility instead of remounting.
- Memoize the three full passes over the personal details list
  (createOptionList, getValidOptions, the UserSelector list copy) with a
  comparator that walks one level into rebuilt record arguments, since the
  snapshot-aware useOnyx rebuilds collection identities on Search pages
  every render.
- Keep the option list Onyx subscriptions warm for the popover lifetime.
@sumo-slonik
sumo-slonik force-pushed the perf/spend-filters-hover branch from 49096a3 to b745fb8 Compare August 7, 2026 10:56
Drop the keep-warm Onyx subscription, the module-level memoization of the
personal detail derivations and the equivalentArgsComparator they needed.
Freezing the form values of backgrounded contents and comparing props on
them keeps the same panes from re-rendering, so the caches are unnecessary.

Explain why React.memo is still needed next to React Compiler: the compiler
caches the whole mountedFilters.map() result in a single slot, so it cannot
bail out on an individual element.
Building an option per personal details entry and filtering the whole option
list are pure derivations of Onyx data, so a remounted filter content can reuse
the previous result instead of walking the collection again.

Both are memoized at module level behind a new equivalentArgsComparator in
@libs/memoize, which compares memoization keys argument by argument: shallowly
first, and one level deeper for plain objects that are rebuilt on every call
from unchanged sources.

Measured on an account with 100k personal details, sweeping and resting on
every filter row: 4.2s of blocked JS down to 1.7s.
Comment thread src/libs/memoize/index.ts Outdated
* The two-level fallback below reads arguments through `Object.keys`, which only describes plain objects - for other
* types (Set, Map, Date, class instances) it returns an empty list and any two instances would look identical.
*/
const isPlainObject = (value: unknown): value is Record<string, unknown> => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use lodash-es/isPlainObject instead ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, switching to it.

Comment thread src/CONST/index.ts Outdated
ACCESSIBILITY_ANNOUNCEMENT_DEBOUNCE_TIME: 1000,
SUGGESTION_DEBOUNCE_TIME: 100,
/** How long the cursor has to stay on an advanced filter row before its content is rendered */
SEARCH_FILTER_HOVER_INTENT_DELAY: 80,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be a potential accessibility issue, if user navigates with keyboard they can land in old pane and then it switches ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, you're right, I'm fixing it.

The 80ms delay is currently applied to both mouse hover and keyboard focus. It makes sense for hover, because it avoids rendering filters you only pass over with the cursor. For keyboard navigation, every focus change is intentional, so the delay just causes the details pane to lag behind the selected row.

* Building an option per personal details entry is the expensive step of this hook and depends only on Onyx values.
* Arguments are compared one level deep because the maps are rebuilt each render from those same unchanged values.
*/
const memoizedCreateOptionList = memoize(createOptionList, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this memoize survive logout ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does - great catch, fixing it.

- Keyboard focus no longer goes through the hover intent delay. Moving focus is
  deliberate and never sweeps across rows, so its content is shown right away
  instead of replacing the pane a keyboard user has already moved into.
- The memoized personal detail caches are released on sign-out, so option lists
  built for the previous account do not stay in memory. Needed a clear() on the
  memoize cache, which it did not expose.
- formAtLastRest and contentVersions are pruned to the mounted filters instead of
  gaining an entry per visited filter.
- equivalentArgsComparator uses lodash/isPlainObject instead of a local copy.
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@roryabraham
roryabraham self-requested a review August 13, 2026 19:14
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@mountiny
mountiny requested a review from truph01 August 20, 2026 08:58
Resolve conflicts in usePersonalDetailOptions and usePersonalDetailSearchSelector/base:
keep the Onyx selectors and includeLoginsOnly filtering from main, and re-apply the
memoized createOptionList, getValidOptions and selected-options derivations on top.
Comment thread src/hooks/usePersonalDetailOptions.ts Resolved
@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@mkhutornyi @truph01, do you have any other comments or feedback?

@mkhutornyi

Copy link
Copy Markdown

Doing some more regression tests. Will update shortly

@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@mkhutornyi Once you've finished testing, could you let me know if anything needs fixing, or if the PR is ready to merge? Thanks!

@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@roryabraham Hi, if everything looks good, can we go ahead and merge this?

We've already had feedback from @truph01 , and @mkhutornyi hasn't added any new comments in the last two days, so I think we might be ready.

@truph01

truph01 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

We've already had feedback from @truph01 , and @mkhutornyi hasn't added any new comments in the last two days, so I think we might be ready.

Yes, all look good from my side

@mkhutornyi mkhutornyi left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for late. LGTM2

web.mov
mobile.mov

@melvin-bot
melvin-bot Bot requested a review from roryabraham September 10, 2026 11:02
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: b9a517e6f0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@MelvinBot

MelvinBot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Two regressions worth fixing before merge, plus three things to confirm. The perf mechanisms themselves check out — Onyx freshness on reveal, cross-account/locale cache isolation, and keyboard navigation are all safe.

1. The option-list caches are never released for the ~13 non-Search consumers

memoizedCreateOptionList / memoizedGetValidOptions / memoizedBuildSelectedOptions now live at module level, but the only non-sign-out release path is useReleaseOptionListCaches.ts:15-33, which is mounted only in SearchPage.tsx:56 and only fires on a left Search navigation transition.

usePersonalDetailOptions / usePersonalDetailSearchSelector have 13 other consumers (attendee and accountant selectors, task assignee, workspace/room/report invite, add delegate, vacation delegate, domain add admin, Expensify-card and company-card assignee steps, approvals expenses-from, workspace owner). A user who never opens Search — say, Inbox → Split expense → Add attendees — fills all three caches and pins them for the whole session. Before this PR nothing was cached at module level, so this retention is new, and it is the same "tens of megabytes" the hook's own doc-comment describes.

Second, smaller hole: the effect's cleanup only unsubscribes. If SearchPage unmounts while off Search, the caches are left populated with no remaining subscriber to release them.

Fix: call the two clear functions from the effect cleanup as well, and mount the hook somewhere that covers the non-Search consumers (or release on a cheaper signal than "left Search").

2. Pane-local state survives a reveal, because hasFilterContentValuesChanged only compares form values

hasFilterContentValuesChanged short-circuits to false when previousValues === values. It cannot see useState inside a pane, and the PR relies on it to decide reveal-vs-remount. Two concrete cases:

Negation toggle. In ListFilterContentPopupWrapper.tsx:37-43, onNegationChange early-returns without calling onChange when nothing is selected. Hover Category with no selection → flip to is not → hover Tag → hover Category: the form was never written, so no remount, and the toggle is still on is not. Pre-PR it reset to is.

Date sub-view. DateFilterContentPopupWrapper.tsx:13 holds selectedDateModifier. Hover Expense date → click On (calendar opens, no form write yet) → hover away → hover back: you land in the calendar rather than the modifier list.

The same shape applies to an uncommitted keyword draft in TextInputFilterContent. Step 4 of the PR resets the search term and scroll on reveal — these are the state that reset missed.

Three things to confirm

  • React Compiler. The 30 ms hover intent depends on markShownFilterReady being reference-stable: useDebounce.ts:50-52 cancels the pending call when func identity changes, and hoverFilter triggers a re-render right after arming it. If SearchAdvancedFiltersPopup/index.tsx bails out of compilation, a user who lands on From/To/Attendee/Assignee and holds still (usePointerMovement only re-arms on ≥8 px travel) sits on the spinner indefinitely. Worth running react-compiler-compliance-check on that file under both Babel and OXC.
  • stopTrackingPointer leftward exit. index.tsx:173-181 returns early without cancelReadyWait(), so the pending 30 ms wait still elapses and still marks the filter ready. Was that meant to be a cancel?
  • maxWait has no test. The maxWait === undefined split is a real lodash bug-fix — on main the options literal always carried a maxWait key, so 'maxWait' in options was true and every caller silently ran throttle-capped-at-wait. All 7 pre-existing call sites are compensated with maxWait: wait, which reproduces main exactly, so no behavior changed. But nothing pins it: all three tests in tests/unit/hooks/useDebounce.test.ts fire a single call, so deleting a maxWait line as "redundant" would silently regress draft saves, @-mention/emoji suggestions and keyboard scroll with green CI. Also note useDebouncedSaveDraft now writes a draft every ~1 s of continuous typing rather than once on pause — presumably intended, but it multiplies compose-path Onyx writes.

Checked and clear

What I ruled out
  • Onyx staleness on reveal. <Activity mode="hidden"> unmounts effects, so useOnyx tears down its subscription and nulls connectedKeyRef. On reveal isFirstConnection is true and getSnapshot re-reads the cache during the reveal render. A contact added or a workspace renamed while hidden does not produce a stale pane.
  • Cross-account / cross-locale cache leak. truncateArgs keeps every argument in the key; accountID is arg 0 of createOptionList and currentUserEmail is arg 0 of getValidOptions, so an account switch always misses. translate is recreated by LocaleContextProvider on a language change, so that misses too. registerSessionCleanupCallback is wired into cleanupSession.
  • equivalentArgsComparator. Over-invalidates rather than under-invalidates for every argument shape actually passed. Arrays, Maps, Sets and class instances are rejected by isPlainObject and fall back to plain shallowEqual (a miss, not a wrong hit); differing key counts miss. One hardening nit: memoize/index.ts:136 uses key in nextArgument, which walks the prototype chain — {toString: Object.prototype.toString} vs {anything: 1} compares equal. Not reachable from Onyx payloads; Object.hasOwn closes it.
  • Cached options are never mutated by a consumer — getValidOptions builds new arrays over the same objects and buildSelectedOptions copies.
  • usePersonalDetailOptions loading short-circuit returns exactly what it did before; the return shape and the !isLoading gate are unchanged.
  • UserSelector's ready prop defaults to true, so the other callers are unaffected; when false it also sets shouldInitialize: false, so no selector runs with an empty exclusion map.
  • Keyboard / screen reader. onFocus → focusFilter marks ready synchronously and reads activeFilter from inside the state updater, so it marks the newly focused row. Hidden Activity subtrees get display: none, so retained panes are out of the a11y tree and add no tab stops.
  • SearchAutocompleteList's maxWait: 300 is dead code — its only renderer always passes inputQueryValue, so hasUpstreamDebounce is always true and debounceHandleSearch never runs.
  • ArrayCache.clear() is complete; the array is the cache's only state.
  • useSelectionListScroll / useIsScrollLikelyLayoutTriggered are bit-identical to main for every non-Search SelectionList consumer.
  • mountedFilters never shrinks, so a category pane stays mounted after switching type Expense → Chat. Bounded to the popover's lifetime and invisible, but it means hidden panes re-render on every form edit.

🤖 Web test steps verification results: ⚠️ partial

I confirmed the instant, no-spinner reveal for non-people filters and the correct contact-list reveal for From after the cursor rests. The rest of the run could not complete: this fresh test account has no extra workspaces, cards or bank accounts (so those filter rows never render), the browser tooling has no keyboard key-event, list-scroll or console-log primitive, and the run ended when a stray click surfaced the test-drive modal.

Popover closed after selecting Expense type

Step Status
1. Fast sweep shows each row's content on arrival, people filters show a spinner, no freezeHovering Type, From, To, Date and Currency in sequence each updated the right pane responsively with no hang; Date rendered its options immediately on hover. The sub-30ms spinner frame itself was not captured — CLI round-trip latency is ~1-2s per command — so this evidences the absence of a freeze, not the spinner.
Date pane rendered immediately on hover, no spinner
✅
2. Resting on From reveals its contact listHovering From and settling transitioned the right pane from the Type list to the is/is-not toggle plus the contact list.
From pane showing contact list after hover settles
✅
3. Typing in From, hovering To, returning shows From instantly with reset search and full listNot reached — the run stopped when the test-drive modal fired.
❌
4. Selecting users applies to the query and rows do not jump under the cursorNot reached — same.
❌
5. Returning to From rebuilds the pane with selected users on topNot reached — same.
❌
6. Reopening the popover reflects the earlier selectionNot reached — no selection was made beforehand. The open/close/reopen cycle itself worked.
❌
7. Keyboard Tab/Arrow navigation moves the pane with no spinnerNot exercised — the web driver exposes no key-event verb. Tool gap, not a product observation; I reviewed this path in code instead and it is sound.
❌
8. Scrolling a long list, hovering away and back shows it reset to top with rows drawnAttempted on Currency (Category is Expense-type only). Scroll reported success and the accessibility tree briefly showed later codes, but every screenshot showed the list still at AED — scroll could not be reliably driven in the nested popover, so this is inconclusive either way.
Currency list after attempted scroll, still at top
❌
9. Same behavior on Workspace, Card, Bank accountNot applicable — those rows only render when the account has multiple workspaces or filterable cards/bank accounts, and this account has none.
❌
10. No console errorsNot verifiable — no console-inspection verb is available for this web session.
❌

The unverified steps need a High Traffic account and a human at the keyboard; they are not evidence against the PR.


view run · no recording available

@roryabraham
roryabraham merged commit b7fcd6e into Expensify:main Sep 10, 2026
39 of 42 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.76-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

MelvinBot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

No help site changes are required for this PR, so I did not create a docs PR.

This is a rendering-performance change to the advanced filters popover on the Spend page. It does not add, remove, rename, or reorder any filter, and it changes no user-facing copy.

How I checked

No copy changed. The diff touches no src/languages/*.ts file and adds no localized strings — grepping the added lines for translate(, Localize, languages/, and label/placeholder props returns nothing. The only new constants are timing/geometry values (SEARCH_FILTER_HOVER_INTENT_DELAY: 30, HOVER_INTENT_REST_RADIUS_PX: 8).

Nothing documented is now wrong. The help site documents which filters exist and how to apply them, not how panes mount or load:

The behavior changes that are user-visible are all below the level the help site describes:

Change in this PR Why it needs no article
Contact list waits for the cursor to rest, showing a spinner first A loading state. The help site documents no loading states for filters.
A spinner replaces the row skeleton (including the native full-screen filter page) Same — swaps one loading indicator for another.
Visited panes stay mounted, so revisiting is instant Faster, same result.
A typed search term is dropped when you leave and return to a pane The help site never documents searching within a filter pane, so no article states the old behavior.
Long filter lists (for example Category) return scrolled to the top Same — undocumented interaction detail.

I checked all articles under docs/articles/ matching filter/search terms; none describe pane loading, hover behavior, in-pane search persistence, or scroll position.

If you think one of these behaviors is worth documenting anyway — the in-pane search term being cleared is the closest call — reply here and I'll open the draft PR.

@sumo-slonik, there is no linked help site PR to review, since no article needed a change. Please confirm you agree, or tell me which behavior you want documented.


view run · no recording available

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.76-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.