Skip to content

refactor: extract MoneyRequestReportEmptyStateView - #100024

Merged
mountiny merged 4 commits into
Expensify:mainfrom
callstack-internal:decompose/money-request-report-transactions-a1
Sep 9, 2026
Merged

mountiny merged 4 commits into
Expensify:mainfrom
callstack-internal:decompose/money-request-report-transactions-a1

Conversation

@sosek108

@sosek108 sosek108 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Pure refactor — no behavior change.

This is PR 2 of a 10-PR stack decomposing the MoneyRequestReport list components (MoneyRequestReportActionsList / MoneyRequestReportTransactionList) into focused hooks and presentational sub-components.

This slice extracts the empty-state branch of MoneyRequestReportActionsList into a dedicated presentational component:

  • New: src/components/MoneyRequestReportView/MoneyRequestReportEmptyStateView.tsx — renders the report fields plus the empty-state card inside a ScrollView, shown when the report has no transactions and no comments.
  • Edit: src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx — the inline ScrollView/MoneyRequestViewReportFields/SearchMoneyRequestReportEmptyState branch is replaced with the new component; the now-unused imports are removed.

This PR alone does not aim to improve performance. I've run performance tests and confirm that there is no regression:

image

Fixed Issues

$ #99919
PROPOSAL:

Tests

  1. Open an expense report that has no transactions and no comments (e.g. create a new empty report from a workspace chat)
  2. Verify the empty-state view renders: report fields at the top and the "empty report" card with the "Add expense" button below
  3. Add an expense to the report and verify the empty state is replaced by the transaction list
  4. Run npx jest tests/ui/MoneyRequestReportActionsListRejectModalTest.tsx and verify it passes
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests — the empty-state view is purely presentational and renders identically offline.

QA Steps

  1. Open an expense report that has no transactions and no comments (e.g. create a new empty report from a workspace chat)
  2. Verify the empty-state view renders: report fields at the top and the "empty report" card with the "Add expense" button below
  3. Add an expense to the report and verify the empty state is replaced by the transaction list
  • 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.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
Nagranie.z.ekranu.2026-09-9.o.09.23.32.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Nagranie.z.ekranu.2026-09-9.o.09.27.30.mov

@sosek108

sosek108 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@codex review
@MelvinBot review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 8b435dc855

ℹ️ 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 9, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Code review: LGTM — the refactor is behavior-neutral, and I verified the empty-state flow on web.

The extracted MoneyRequestReportEmptyStateView.tsx renders the same tree the inline branch did, with the same props and the same styles.flexGrow1 container. Prop types line up: report: Report matches the parent's non-nullable cast at MoneyRequestReportActionsList.tsx:132, and policy: OnyxEntry<Policy> satisfies both children. No leftover references to the removed imports, and the two child components keep their other callers. I found nothing to change.

What I checked
  • No stale references: ScrollView, MoneyRequestViewReportFields, and SearchMoneyRequestReportEmptyState have zero remaining usages in MoneyRequestReportActionsList.tsx, so removing the imports is safe. Both children are still imported by MoneyRequestReportUnifiedList.tsx and MoneyRequestReportTransactionList.tsx, so nothing is orphaned.
  • Types: SearchMoneyRequestReportEmptyState takes policy?: Policy and MoneyRequestViewReportFields takes OnyxEntry<Policy> — the wrapper's OnyxEntry<Policy> works for both. report is correctly the tighter non-nullable Report, matching the parent.
  • No memo needed: React Compiler is enabled repo-wide (babel-plugin-react-compiler in babel.config.js), so the new component boundary doesn't need manual memoization the way the older memo(...)-wrapped siblings in this directory do. The React Compiler Compliance check passes.
  • JSDoc accuracy: "Rendered instead of the unified list" is correct — the sibling branch renders MoneyRequestReportTransactionList, which renders MoneyRequestReportUnifiedList internally.
  • Test coverage: tests/ui/MoneyRequestReportActionsListRejectModalTest.tsx mocks @components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState by module path, so it still resolves through the new wrapper. All 8 test CI jobs pass.
  • CI: every check passes except Check independent approval, which just needs a human reviewer.

🤖 Web test steps verification results: ✅ pass

Empty-report view renders correctly on this branch: report fields display at the top with the empty-state card and "Add expense" button below, and adding an expense correctly replaces the empty state with the transaction view. No failed network requests were observed.

Report view after adding an expense, empty state replaced by transaction detail

Step Status
Create a new empty expense report from a workspace chat and confirm it opensUsed workspace chat composer + menu -> Create report; report 'Expense Report 2026-09-09' opened as a Draft with 0 expenses.
✅
Empty-report view renders: report fields at top and empty-report card with Add expense button belowSnapshot and screenshot show header fields (title, Draft badge, From/in breadcrumb, More button, status text) at top, and the empty-state card (illustration, 'No expenses yet' heading, 'Add expense' button) below.
Empty expense report view with report fields at top and empty-state card with Add expense button
✅
Adding an expense replaces the empty state with the transaction list/viewAfter creating a manual $25.00 expense at 'Test Coffee Shop', the 'No expenses yet' heading and Add expense button were gone; report now shows the transaction detail (Amount/Merchant/Date/Category) and a Submit button in the header.
Report view after adding an expense, empty state replaced by transaction detail
✅
No JS console errors during the flowNo direct browser console-log capture is exposed for web sessions, so I checked the network dump instead: all API calls (OpenReport, CreateAppReport, RequestMoney, CreateWorkspace, AuthenticatePusher) returned status=200 with no failures.
✅

view run · no recording available

@sosek108
sosek108 marked this pull request as ready for review September 9, 2026 07:39
@sosek108
sosek108 requested review from a team as code owners September 9, 2026 07:39
@melvin-bot
melvin-bot Bot requested review from dylanexpensify and suneox and removed request for a team and dylanexpensify September 9, 2026 07:39
@melvin-bot

melvin-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

@suneox 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 September 9, 2026 07:39
@suneox

suneox commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

I'll take a look at this one after an hour

@suneox

suneox commented Sep 9, 2026

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 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
    • 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
    • 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 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

Android: HybridApp
CleanShot.2026-09-09.at.17.57.39.1.mp4
Android: mWeb Chrome Screenshot_1788951140
iOS: HybridApp
CleanShot.2026-09-09.at.17.47.20.1.mp4
iOS: mWeb Safari Simulator Screenshot - iPhone 17 Pro - 2026-09-09 at 17 51 40 Simulator Screenshot - iPhone 17 Pro - 2026-09-09 at 17 51 08
MacOS: Chrome / Safari
CleanShot.2026-09-09.at.17.43.30.1.mp4

@suneox suneox 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.

This is a minor component split, performance verification comes with the next PRs

@melvin-bot
melvin-bot Bot requested a review from mountiny September 9, 2026 11:03
@mountiny
mountiny merged commit b54d2d5 into Expensify:main Sep 9, 2026
35 of 37 checks passed
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Sep 9, 2026

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 OSBotify mentioned this pull request Sep 9, 2026
83 tasks done
@OSBotify

OSBotify commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.75-0 🚀

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

@MelvinBot

MelvinBot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

No help site changes required

This PR is a pure internal refactor, so nothing under docs/articles needs to change. No draft docs PR was created.

Why I concluded this

The diff touches only two files:

The extracted JSX passes the same report, policy, and onLayout props to the same children in the same order, inside the same styles.flexGrow1 ScrollView. The rendered output is identical.

The help site documents what users see and do. This PR changes none of that:

  • No copy changes — no src/languages/*.ts files are touched, so every label, button, and empty-state string is unchanged.
  • No UI changes — no styles, layout, or component hierarchy changes.
  • No new or changed flows — the empty-state branch still triggers on the same condition (report with no transactions and no comments).
  • No settings, tabs, or feature names added or renamed.

Articles that describe the empty report experience — such as Create-and-Submit-Reports.md and Managing-Expenses-in-a-Report.md — remain accurate as written.

@sosek108, there is no linked help site PR to review, because this refactor does not change anything a help article describes. If a later PR in this 10-PR stack changes user-facing copy or behavior, tag me on that PR and I will draft the docs update then.


view run · view recording

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

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

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 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.

5 participants