Skip to content

Decompose ReportActionsList: 6#93694

Open
LukasMod wants to merge 11 commits into
Expensify:mainfrom
callstack-internal:decompose/ral-6
Open

Decompose ReportActionsList: 6#93694
LukasMod wants to merge 11 commits into
Expensify:mainfrom
callstack-internal:decompose/ral-6

Conversation

@LukasMod

@LukasMod LukasMod commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

part of the ReportActionsList decomposition series (#88320)

Splits the old ReportActionsView into two clear pieces: a thin route-only orchestrator that decides what to render, and a hook-driven body that renders the chat list. No user-facing behavior changes — this is a structural refactor.

Changes

  • New src/pages/inbox/ReportActions.tsx — a route-only orchestrator. It owns the coarse branching: the skeleton states, the money-request-vs-chat decision, mounting UserTypingEventListener, and the app-load open-report telemetry mark (markOpenReportEnd(report, {warm: false})).
  • src/pages/inbox/report/ReportActionsList.tsx (the body) is now hook-driven — its props shrink to {reportID, onLayout?} and it self-fetches via the PRs 2–5 hooks (pagination, visibility, unread markers, scroll, concierge) instead of receiving ~18 props.
  • ReportScreen now mounts <ReportActions/> instead of the old wrapper.
  • MoneyRequestReportView mounts the body (ReportActionsList) directly and mounts UserTypingEventListener itself — it intentionally does not route through the orchestrator (MRR branching stays put, per the blueprint).
  • Deleted: ReportActionsView.tsx, the old 58-LOC inbox/ReportActionsList.tsx wrapper, and getReportActionsListInitialNumToRender.ts (+ its test).

Unit Tests

  • tests/ui/ReportActionsTest.tsx — orchestrator: skeleton states, money-request-vs-chat branch, typing mount, app-load warm: false telemetry.
  • tests/ui/ReportActionsListTest.tsx — body: concierge / fine-grained skeleton behavior (mounts the body directly with a seeded Onyx store).
  • tests/ui/MoneyRequestReportViewTest.tsx — the second consumer mounts the body + typing listener (chat path) and the table view (money-request path).
  • tests/perf-test/ReportActionsList.perf-test.tsx — rewritten against the new body surface (see below).

Perf — re-baselined (not a regression)

The perf test was rewritten to match the new hook-driven body. The render number went 17.7 ms → 37 ms, and render from 3->6 but this is a re-baseline, not a regression — the two harnesses measure different things.

  • Old harness (17.7 ms): fed a pre-sorted 500-action array straight into the body via props. It bypassed getSortedReportActionsForDisplay (sorting 500 actions), getContinuousChain (pagination), and useReportActionsVisibility (the concierge/session/visible filter). The component was handed finished data and just rendered it.
  • New harness (37 ms): seeds raw REPORT_ACTIONS into Onyx, so the hook-driven body runs that entire pipeline on mount — exactly what production does on every report open. The extra ~19 ms is the cost of the sort + paginate + filter that the old test hid, plus the per-hook useOnyx subscriptions the decomposition introduced.

Production always paid that ~37 ms; the old test just never measured it. The old 17.7 ms figure is discarded — it's not comparable. To be able to see [render] times in perf tests I applied this config fix, as now it seems to be broken on main: #93573

Fixed Issues

$ #89767
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Test 1: Open a regular chat

  1. Open a regular chat (1:1 or group).
  2. Expect: Messages render; no infinite skeleton; can scroll.

Test 2: Deep-link to an old message

  1. Deep-link to an old message (open a link to a specific reportAction).
  2. Expect: Opens scrolled to that message, not the bottom.

Test 3: Open an expense report with multiple transactions

  1. Open an expense report with multiple transactions.
  2. Expect: Shows the table view (MoneyRequestReportActionsList), not the chat list.

Test 4: Open an expense report that renders chat-style

  1. Open an expense report that renders chat-style (no table view).
  2. Expect: Shows the chat list.

Test 5: Open a single expense / transaction-thread report

  1. Open a single expense / transaction-thread report (drill into one transaction inside a money report).
  2. Expect: Chat thread renders below the money-request header.

Test 6: Typing indicator in a 1:1 chat

  1. In a 1:1 chat, have the other party type (or use two sessions).
  2. Expect: "… is typing" appears (route path).

Test 7: Typing indicator in a transaction-thread report

  1. In a transaction-thread report, have someone type.
  2. Expect: Typing indicator appears here too (only if single expense).

Test 8: Open the Concierge DM

  1. Open the Concierge DM.
  2. Expect: Loads without a wrong-content flash

Test 9: Open an unread report

  1. Open an unread report.
  2. Expect: It becomes read (unread badge clears in LHN).

Test 10: Scroll up to load older messages, then back down

  1. Scroll up to load older messages, then back down.
  2. Expect: Older messages load; scrolling to the bottom marks the newest as read.

Offline tests

QA Steps

  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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
andoird.native.mov
Android: mWeb Chrome
android.chrome.mov
iOS: Native
ios.native.mov
iOS: mWeb Safari
ios.safari.mov
MacOS: Chrome / Safari
web1.mov
web2.mov

@LukasMod LukasMod changed the title [NoQA] decompose ReportActionsList: 6 [WIP] [NoQA] decompose ReportActionsList: 6 Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 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 Δ
.../MoneyRequestReportView/MoneyRequestReportView.tsx 56.84% <ø> (+56.84%) ⬆️
src/hooks/useIsReportReadyToDisplay.ts 100.00% <ø> (ø)
src/hooks/useMarkAsRead.ts 97.10% <100.00%> (+3.07%) ⬆️
src/hooks/useReportActionsScroll.ts 97.87% <ø> (-0.03%) ⬇️
src/libs/ReportActionsUtils.ts 77.68% <ø> (ø)
src/libs/actions/Report/index.ts 69.37% <ø> (ø)
src/pages/inbox/ReportActions.tsx 100.00% <100.00%> (ø)
src/pages/inbox/ReportScreen.tsx 95.65% <100.00%> (ø)
src/pages/inbox/report/ReportActionsList.tsx 82.43% <87.65%> (+3.15%) ⬆️
... and 10 files with indirect coverage changes

@LukasMod LukasMod changed the title [WIP] [NoQA] decompose ReportActionsList: 6 [NoQA] decompose ReportActionsList: 6 Jun 17, 2026
@LukasMod LukasMod changed the title [NoQA] decompose ReportActionsList: 6 Decompose ReportActionsList: 6 Jun 17, 2026
LukasMod added 9 commits June 17, 2026 12:50
Add src/pages/inbox/ReportActions.tsx as the route-only orchestrator that owns
the coarse branching (skeleton / money-request table view / chat list) and
subscribes to only what those branches need. ReportScreen now mounts it instead
of the old 58-LOC inbox/ReportActionsList.tsx wrapper, which is removed.
ReportActionsView stays for now (still used by MoneyRequestReportView) and is
deleted in the next commit.

The app-load skeleton is hoisted out of the hook-driven body into the
orchestrator so the body's data hooks/effects never run during app boot. It is
evaluated on the chat path only (after the money-request branch) to preserve the
prior behavior, where that skeleton lived inside the chat-only ReportActionsView,
and it owns the warm:false markOpenReportEnd telemetry for the branch it gates.

Add tests/ui/ReportActionsTest.tsx covering the orchestrator's branching
decisions and the app-load telemetry mark.
@LukasMod

LukasMod commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Regardless failing perf test, check PR description section about it. I compared sending messages with profiler and spans and didn't spot difference in performance (only noise)

image

@LukasMod LukasMod marked this pull request as ready for review June 17, 2026 11:17
@LukasMod LukasMod requested review from a team as code owners June 17, 2026 11:17
@melvin-bot melvin-bot Bot requested review from DylanDylann and heyjennahay and removed request for a team June 17, 2026 11:18
@melvin-bot

melvin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

@DylanDylann 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 June 17, 2026 11:18

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ec39cb02e

ℹ️ 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/pages/inbox/report/ReportActionsList.tsx
@LukasMod

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e93921114a

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

<>
<ReportActionsList
key={report.reportID}
reportID={report.reportID}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the chat body keyed to the route report

When switching between reports, the Onyx subscription for the new key can temporarily expose the previous report while the new value is loading (the repo already guards this state in useIsReportReadyToDisplay by comparing report.reportID with the route ID). Passing report.reportID here makes the chat list subscribe to and render the old report during that transition; the previous ReportActionsView was invoked with the route ID, so it could stay on the requested report key and show a skeleton instead of flashing the wrong chat. Please pass/guard against reportIDFromRoute here so report transitions don't attach the list to stale report data.

Useful? React with 👍 / 👎.

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.

Subscription returns either the new report or undefined, never the previous one and we keep relay on report around instead. I will keep it as it is

@LukasMod

Copy link
Copy Markdown
Contributor Author

@DylanDylann Could you take a look on this?

@DylanDylann

Copy link
Copy Markdown
Contributor

Sure, I will complete my review this week

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.

2 participants