Skip to content

Speed up SearchRouter open on large accounts#95378

Merged
mountiny merged 10 commits into
Expensify:mainfrom
software-mansion-labs:perf/search-router-list-render
Jul 21, 2026
Merged

Speed up SearchRouter open on large accounts#95378
mountiny merged 10 commits into
Expensify:mainfrom
software-mansion-labs:perf/search-router-list-render

Conversation

@sumo-slonik

@sumo-slonik sumo-slonik commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

On the Sentry "P90 vital metrics - large accounts" dashboard, ManualOpenSearchRouter roughly doubled to ~1s p90 in production — almost entirely in SearchRouter.ListRender, which builds the initial empty-query option list. Two structural issues, both scaling linearly with account size:

  • createFilteredOptionList is rebuilt from scratch on every open (no caching between opens; two unstable input references blocked memoization).
  • Step 5 builds an option object for every personal detail, uncapped (19k+ on large accounts) — wasted at empty query, which never shows standalone contacts.

Fix

  1. Module-level cache for createFilteredOptionList — a small keyed map (one entry per screen config, bounded to 8 with LRU eviction) validated by reference equality of its Onyx inputs (plus reference-stabilized usePrivateIsArchivedMap/visibleReportActionsData, with the active locale and a report-actions version in the key). Reopening reuses the previous result while Onyx is unchanged; each caller gets a shallow clone so in-place mutations don't leak across screens, and isSearching results aren't cached.
  2. New deferContactsUntilSearch, enabled only for the SearchRouter — skips per-contact options while the query is empty; typing flips isSearching and builds the full set. Other useFilteredOptions consumers keep the default and are unaffected.

Performance results

Measured on web dev, span SearchRouter.ListRender (empty-query open — the Sentry-tracked metric). Each cell is the mean of 100+ opens driven by Playwright: a script clicks the search button, reads the span duration from the console, closes the router, and repeats.

  • Cold = full rebuild — the cache entry is invalidated before each open so the full build runs (forced by changing a cached Onyx input; the keyed cache now survives typing, so a typed character no longer invalidates it).
  • Warm = immediate reopen with a cache hit. On main there is no cache, so cold ≈ warm.

Accounts are ordered by increasing gain; all bars share one scale (1 block ≈ 10 ms).

Account 1 — expensify@swmansion.com (small real account, no seeding): 588–610 reports, 273–305 transactions, 265 transaction violations, 255 policies, ~2.8–2.9k Onyx keys; 140–161 real personal details (the account was syncing from staging during the run, so counts drifted slightly upward between the branch and main passes — figures shown are the observed ranges).

Cold open (rebuild) Warm reopen
Before (main) ██████████░░░░░░ ~103 ms ██████████░░░░░░ ~103 ms
After ██████████░░░░░░ ~96 ms █████████░░░░░░░ ~91 ms
Δ −7% −12%

Account 2 — applausetester@applause.expensifail.com (large account, all data real, no seeding): 2,457 reports, 2,777 transactions, 969 transaction violations, 129 policies, ~11.5k Onyx keys; 19,178 real personal details.

Cold open (rebuild) Warm reopen
Before (main) ███████████████░ 150 ms ███████████████░ 151 ms
After ████████████░░░░ ~125 ms ███████████░░░░░ ~113 ms
Δ −16% −25%

Account 3 — expensify@swmansion.com (same account, seeded): ~600 reports, ~300 transactions, 255 policies, ~2.9k Onyx keys; 166 real personal details, seeded up to 19,161 synthetic contacts to reproduce large-account contact volume.

Cold open (rebuild) Warm reopen
Before (main) ████████████████ 160 ms ████████████████ 160 ms
After ███████████░░░░░ ~108 ms ██████████░░░░░░ ~102 ms
Δ −33% −36%

Conclusions. The gain comes entirely from cutting per-contact work at empty query, so it scales with contact count: −7/−12% at ~150 contacts up to −33/−36% at ~19k — exactly the large accounts the Sentry dashboard flagged, with no cost to small ones. Account 3 gains more than the larger Account 2 despite being smaller overall because the saving comes from contacts, and for the seeded account contacts are almost its entire cost — whereas Account 2's 2.4k reports / 2.8k transactions are fixed rebuild cost the PR doesn't remove.

Fixed Issues

$ #95585
PROPOSAL:

Tests

  1. Sign in with an account that has multiple chats and contacts (ideally a High Traffic account).
  2. From the Inbox, open the Search Router (click the magnifying glass button or press Cmd+K / Ctrl+K).
  3. Verify the empty-query list shows the "Recent searches" and "Recent chats" sections, exactly as before this change.
  4. Type the name of a contact you have no recent chat with — verify the matching contact appears in the results.
  5. Type from: followed by a few letters of a contact's name — verify the autocomplete suggests matching contacts.
  6. Clear the input — verify the list returns to the empty state ("Recent searches" + "Recent chats").
  7. Press Escape to close the router, then reopen it — verify the same content is shown and the router opens without any visible delay or flicker (reopen should feel instant).
  8. Change the app language in Settings > Preferences, reopen the Search Router — verify report names and subtitles are shown in the new language.
  • Verify that no errors appear in the JS console

Offline tests

Unnecessary — this PR only changes how the Search Router option list is built (caching + skipping unused work); it does not touch any network or persistence logic.

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 any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/components/Search/SearchAutocompleteList.tsx 93.23% <ø> (-0.04%) ⬇️
src/hooks/useFilteredOptions.ts 81.81% <100.00%> (+1.81%) ⬆️
src/hooks/useSearchSelector/base.ts 82.52% <ø> (ø)
src/libs/OptionsListUtils/index.ts 87.12% <100.00%> (+0.22%) ⬆️
src/libs/SessionCleanup.ts 100.00% <100.00%> (ø)
src/libs/actions/Session/index.ts 42.76% <100.00%> (+0.12%) ⬆️
src/pages/NewChatPage/index.tsx 78.47% <ø> (ø)
src/pages/Share/ShareTab.tsx 0.00% <ø> (ø)
src/hooks/usePrivateIsArchivedMap.ts 87.50% <84.61%> (-12.50%) ⬇️
... and 101 files with indirect coverage changes

/** Whether search mode is active - when true, builds full report map for personal details (default: false) */
isSearching?: boolean;
/** Beta features the user has access to */
betas?: OnyxEntry<Beta[]>;

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.

Removed betas because it was dead code: createFilteredOptionList never read it (only declared in the options type), and it was the one input excluded from the cache key — a trap if someone ever started using it. No behavior change: screens still pass betas to getSearchOptions/getValidOptions, where beta filtering actually happens.

Comment thread src/libs/OptionsListUtils/index.ts Outdated
// Contacts are expensive to build on large accounts (one option per personal detail). When a screen
// opts into deferral and is not actively searching, skip building them entirely; the empty state
// does not display standalone contacts, and typing flips `isSearching` which rebuilds the full set.
const shouldBuildContacts = includeP2P && !(deferContactsUntilSearch && !isSearching);

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 we simplify this? maybe extract one more variable to write it more clearly

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.

Done 👍 Extracted an intermediate variable so the double negation is gone:

const areContactsDeferred = deferContactsUntilSearch && !isSearching;
const shouldBuildContacts = includeP2P && !areContactsDeferred;

Comment thread src/hooks/usePrivateIsArchivedMap.ts Outdated
registerSessionCleanupCallback(() => {
cachedSource = undefined;
cachedMap = {};
hasCached = false;

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.

I wonder if we really need this boolean. If I understand it correctly after first caching, it's always true, isn't it?

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, it was redundant

Comment thread src/libs/OptionsListUtils/index.ts Outdated
// does not display standalone contacts, and typing flips `isSearching` which rebuilds the full set.
const shouldBuildContacts = includeP2P && !(deferContactsUntilSearch && !isSearching);

const cacheEntryKey = `${maxRecentReports}_${includeP2P}_${isSearching}_${deferContactsUntilSearch}`;

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.

Maybe let's add a function to generate this key :)

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.

And I wonder, should we take into account locale here?

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.

Done

Comment thread src/libs/OptionsListUtils/index.ts Outdated
* empty state (contact pickers) must leave this false.
*/
deferContactsUntilSearch?: boolean;
/** Active locale; defaults to `IntlStore.getCurrentLocale()`. Pass it from a hook to recompute on language switch. */

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.

NAB: To me comment for locale is unnecessary

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.

Done

@sumo-slonik

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: e9cf1bb18e

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

Comment thread src/hooks/useFilteredOptions.ts
@mountiny
mountiny requested a review from shubham1206agra July 8, 2026 11:42
@mountiny

mountiny commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@codex review
@MelvinBot review

Copilot AI left a comment

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.

Pull request overview

This PR reduces SearchRouter open latency on large accounts by avoiding expensive, contact-heavy option building on empty query and by reusing createFilteredOptionList results between opens when relevant Onyx inputs are unchanged.

Changes:

  • Add an LRU, module-level cache for createFilteredOptionList (cache hits gated by referential equality of Onyx inputs + locale + report-actions version).
  • Introduce deferContactsUntilSearch to skip building per-contact options until a non-empty query is entered (used for SearchRouter/autocomplete).
  • Add session-signout cleanup hooks for module-level caches, plus tests/perf-test updates to keep runs deterministic.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/OptionsListUtilsTest.tsx Clears the new module cache per test; adds unit coverage for deferContactsUntilSearch.
tests/perf-test/OptionsListUtils.perf-test.ts Clears cache between perf-test iterations to measure cold-build behavior.
src/pages/Share/ShareTab.tsx Removes now-unneeded betas config from useFilteredOptions call.
src/pages/NewChatPage/index.tsx Removes now-unneeded betas config from useFilteredOptions call.
src/libs/SessionCleanup.ts Adds a dependency-light registry for “clear module cache on sign-out” callbacks.
src/libs/OptionsListUtils/index.ts Implements cached createFilteredOptionList, stable defaults, contacts deferral option, and cache invalidation inputs.
src/libs/actions/Session/index.ts Runs session cleanup callbacks during cleanupSession() on sign-out.
src/hooks/useSearchSelector/base.ts Removes now-unneeded betas config from useFilteredOptions call.
src/hooks/usePrivateIsArchivedMap.ts Adds a stable-reference cache for the derived archived map, with sign-out cleanup.
src/hooks/useFilteredOptions.ts Adds deferContactsUntilSearch, removes betas, and forces recompute on locale changes.
src/components/Search/SearchAutocompleteList.tsx Enables deferContactsUntilSearch for empty-query SearchRouter-like behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/hooks/usePrivateIsArchivedMap.ts Outdated

import useOnyx from './useOnyx';

type PrivateIsArchivedMap = Record<string, boolean>;
Comment thread src/libs/SessionCleanup.ts
@MelvinBot

Copy link
Copy Markdown
Contributor

Review

Solid, carefully-documented perf PR. I traced the two mechanisms end-to-end against the code and they're correct: the empty-query SearchRouter state never renders standalone contacts, so deferContactsUntilSearch is safe, and the shallow-clone cache invariant is precisely calibrated to how consumers mutate options today. A few things worth confirming before merge — none are blocking.

✅ Verified

  • betas removal is safe. It was a dead parameter — declared in createFilteredOptionList's options type on main but never destructured or used in the body. Every caller that dropped it (SearchAutocompleteList, ShareTab, NewChatPage, useSearchSelector/base) still uses its betas Onyx value elsewhere, so no unused-var lint fallout.
  • Deferring contacts is correct. The only prod caller is useFilteredOptions, and in SearchAutocompleteList the empty-query path returns before touching personalDetails (contacts are only consumed via combineOrderingOfReportsAndPersonalDetails, which is guarded behind a non-empty query). So skipping the per-contact build at empty query changes nothing user-visible.
  • The shallow clone is genuinely load-bearing, not defensive. getValidOptions mutates personalDetails option objects in place (isBold/brickRoadIndicator/isSelected) without spreading first, so without cloneOptionList the cache would be corrupted immediately. The report path spreads ({...option}) so it's independently safe. Current mutations are all top-level scalars — exactly what the shallow clone covers.

🟡 Worth confirming

  1. The warm-reopen cache gains may largely evaporate in production — for exactly the accounts this targets. deprecatedReportActionsVersion++ fires on every REPORT_ACTIONS collection change and is part of the cache key, so any inbound message anywhere invalidates the whole cache. On a large/active account (the Sentry-flagged profile), Pusher delivers report-action updates constantly, so a close→reopen will frequently land on a cold rebuild rather than the measured warm path. The reported −12%/−25%/−36% warm numbers were measured on web dev with a quiet account; they likely won't hold in the field. This is fine given you already note the real win is deferring contacts — but it means the caching layer (LRU map + version tracking + shallow-clone-with-invariant + session cleanup + ref-stabilization of usePrivateIsArchivedMap) is a fair amount of surface area and ongoing maintenance risk for a benefit that may be marginal in production. Worth a sentence on why it's still worth keeping, or consider whether deferContactsUntilSearch alone captures most of the gain.

  2. The shallow-clone invariant has no runtime guard — only comments. Any future consumer that mutates a nested field (icons, participantsList, item, allReportErrors) in place will silently corrupt the cache for every other screen, and nothing will catch it in review or CI. Since the correctness of the whole cache rests on this, consider Object.freeze-ing the cached entry's nested objects in __DEV__ (or freezing the pristine result before caching) so a violating mutation throws loudly in dev/tests instead of producing a heisenbug. Same read-only invariant applies to the now-shared module-level map from usePrivateIsArchivedMap — confirmed current consumers only read it.

  3. Cache-completeness check. The cache key/inputs cover the inputs I could find that affect output (the five Onyx collections, visibleReportActionsData, isTrackIntentUser, locale, and the report-actions version proxy). The one thing I'd double-check: whether anything reached transitively by createOption/processReport reads module-level connected state other than the sorted report actions (which the version covers) and the current locale (covered) — e.g. current-user/session-scoped values that could change without touching any tracked reference. If there's nothing, great; if there is, it needs to be in the key.

Testing

I did not run the suite. Given the caching, the module-level cache being cleared per-test via the new beforeEach (correctly placed at the top-level describe, so it applies file-wide) is what keeps the existing tests order-independent — worth confirming CI is green, since a stale cache across tests would surface as flakiness rather than a hard failure.

How I reviewed

Checked out the PR branch, compared createFilteredOptionList against origin/main to confirm betas was dead, traced the single prod caller (useFilteredOptionsSearchAutocompleteList) to verify the empty-query path never reads contacts, and inspected the two in-place mutation sites in getValidOptions to confirm the shallow clone is required and sufficient for current code.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: e9cf1bb18e

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

@sumo-slonik
sumo-slonik force-pushed the perf/search-router-list-render branch from 947b353 to c38c6a5 Compare July 9, 2026 09:44
Cache createFilteredOptionList results between opens, defer building
contact options until the user types a query, and clear the caches on
sign-out.
@sumo-slonik
sumo-slonik force-pushed the perf/search-router-list-render branch from cb0e894 to eaabef6 Compare July 9, 2026 10:43
@sumo-slonik

Copy link
Copy Markdown
Contributor Author

All review feedback addressed. I verified the fixes have no negative perf impact (A/B control run) — the gain vs main holds, and a functional re-test of the SearchRouter passed clean. Ready for review 🙏

@sumo-slonik
sumo-slonik marked this pull request as ready for review July 9, 2026 10:54
@sumo-slonik
sumo-slonik requested review from a team as code owners July 9, 2026 10:54
@melvin-bot
melvin-bot Bot requested review from flaviadefaria and mountiny and removed request for a team July 9, 2026 10:54
@melvin-bot

melvin-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

@mountiny 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]

@melvin-bot
melvin-bot Bot removed the request for review from a team July 9, 2026 10:54
Comment thread src/libs/SessionCleanup.ts
Comment thread src/libs/OptionsListUtils/index.ts Outdated
Replace the deprecatedReportActionsVersion counter (bumped inside the
deprecated Onyx.connect callback) with the reference of sortedActions
from the RAM_ONLY_SORTED_REPORT_ACTIONS derived value, which produces a
new object on every recompute. useFilteredOptions now passes
sortedActions down through processReport to createOption, so this call
path also reads sorted actions from the derived value instead of the
deprecated module-level map.
# Conflicts:
#	tests/unit/OptionsListUtilsTest.tsx
Comment on lines +1694 to +1696
// Search-mode results contain an option for every report and contact, so caching them would retain
// full-account-sized arrays until sign-out — and any Onyx change invalidates them anyway.
const shouldUseCache = !isSearching;

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.

@WojtekBoman Should we use the cache when building full personal details, shouldBuildContacts is true?

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.

Search-mode results are already reused by useMemo while typing (the query isn't a build input), and SearchForReports Onyx updates keep invalidating them anyway. Caching these builds would retain our largest results (no maxRecentReports cap) for hits that would almost never occur.

…st-render

# Conflicts:
#	src/components/Search/SearchAutocompleteList.tsx
@shubham1206agra

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Screen.Recording.2026-07-20.at.11.12.57.PM.mov

Comment thread src/hooks/usePrivateIsArchivedMap.ts
Comment thread tests/unit/SessionCleanupTest.ts
Comment thread src/libs/SessionCleanup.ts
@mountiny
mountiny merged commit 1c10743 into Expensify:main Jul 21, 2026
37 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny 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.

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.

7 participants