Skip to content

Refactor ReportField logic to simplify report editability condition - #105939

Merged
puneetlath merged 7 commits into
Expensify:mainfrom
DylanDylann:dylann/101573-report-field-create-and-none
Nov 11, 2026
Merged

puneetlath merged 7 commits into
Expensify:mainfrom
DylanDylann:dylann/101573-report-field-create-and-none

Conversation

@DylanDylann

@DylanDylann DylanDylann commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

From #105028 (comment)

When you create an expense, the report list now always starts with two options: Create report and None.

  • None leaves the new expense off any report. It moves the draft to your self DM, the same as picking yourself as the recipient, and switches the form to a track expense so the category, tax and distance rate fields match. It shows in both the anchored dropdown and the full-page picker for submit, create and track expenses. It's hidden for per diem and time expenses (they only exist on a workspace), splits, invoices, and when editing a saved expense.
  • Create report now makes the report on the workspace the expense is going to, instead of your default workspace.
  • Since those two options are always there, the Report row can always be opened while creating an expense, even when the workspace has no open report. It stays locked when you create an expense from inside an expense report, and when you edit an expense that's on a report and there's no other report to move it to.
  • When no report is picked yet, the full-page picker opens from the chat the expense is being created in, not from a placeholder report ID.
  • Moving a draft to the self DM (participants, unreported report ID, distance rate) now lives in moveMoneyRequestDraftToSelfDM, so the participant picker and the None option share it.

This PR doesn't change the default report. It's still the open report on the expense's workspace, or New report when that workspace has none.

Fixed Issues

$ #101573
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Precondition: two workspaces, A (your default) and B, where B has no open report.

  1. In workspace B's chat, start a manual expense and go to the confirmation page. Verify the Report field shows "New report" and can be opened, even though B has no open report.
  2. Open the Report field. Verify the list starts with Create report and None.
  3. Pick Create report. Verify the new report is made on workspace B, not on A.
  4. Start another expense in B's chat, open Report and pick None. Verify:
    • the Report field shows "None";
    • the form switches to a track expense (the confirm button tracks it instead of submitting);
    • after confirming, the expense shows in your personal space and not on a report.
  5. Repeat step 4 with the full-page report picker (without the anchoredFieldDropdowns beta, or on a narrow screen). Verify the same result.
  6. Start a per diem, a time, a split and an invoice expense. Verify None is not in the report list for any of them.
  7. Inside an open expense report, add an expense with the + button. Verify the Report field is locked.
  8. Open a saved expense on a report while no other open report exists. Verify the Report field is locked. Create a second report, then verify it opens with no None option.
  9. In a workspace that has an open report, start an expense. Verify the Report field still defaults to that report.
  • 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 any copy / text that was added to the app 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 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 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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

MacOS: Chrome / Safari
Screen.Recording.2026-11-06.at.15.51.31.mov

@DylanDylann
DylanDylann marked this pull request as ready for review November 5, 2026 05:25
@DylanDylann
DylanDylann requested review from a team as code owners November 5, 2026 05:25
@melvin-bot
melvin-bot Bot requested review from ikevin127 and thelullabyy and removed request for a team November 5, 2026 05:26
@melvin-bot

melvin-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

@ikevin127 @thelullabyy One of you needs to 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 requested review from trjExpensify and removed request for a team November 5, 2026 05:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T05:45:41.913700Z 75c10a4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@DylanDylann
DylanDylann removed the request for review from thelullabyy November 5, 2026 05:38

@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: 75c10a4b29

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

@ikevin127

ikevin127 commented Nov 5, 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.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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-11-05.at.16.08.18.mov

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

When you don't have any eligible reports, it doesn't seem like there's a "None" option in the dropdown to have the expense created unreported.

No existing eligible reports:

  • Create report [Default]
  • None <— the option to create it unreported.

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

Looks good overall, only 2 comments.

@DylanDylann

Copy link
Copy Markdown
Contributor Author

@trjExpensify Can you confirm this is your expectation?

Screen.Recording.2026-11-06.at.15.51.31.mov

@codecov

codecov Bot commented Nov 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/CONST/SENTRY_LABEL.ts 100.00% <ø> (ø)
...tConfirmationList/sections/ReportFieldDropdown.tsx 96.66% <100.00%> (+0.23%) ⬆️
src/hooks/useConfirmationParticipantSelection.ts 92.30% <100.00%> (+2.75%) ⬆️
...es/iou/request/step/IOURequestEditReportCommon.tsx 87.12% <100.00%> (+0.63%) ⬆️
...URequestStepReport/hooks/useReportPickerActions.ts 95.23% <96.00%> (+0.74%) ⬆️
...eyRequestConfirmationList/sections/ReportField.tsx 76.78% <50.00%> (-1.00%) ⬇️
src/libs/actions/IOU/MoneyRequest.ts 83.10% <66.66%> (-0.70%) ⬇️
...s/iou/request/step/DynamicIOURequestStepReport.tsx 72.00% <45.45%> (-21.75%) ⬇️
... and 701 files with indirect coverage changes

@trjExpensify

Copy link
Copy Markdown
Contributor

@trjExpensify Can you confirm this is your expectation?

You have auto-reporting enabled here, right? If so why is "New report" the default in the preview (first screenshot), if you seemingly also have eligible reports (second screenshot)?

image image

@DylanDylann

Copy link
Copy Markdown
Contributor Author

@trjExpensify The expense is going to my default workspace (Dylandylan's Workspace, the one under "Create report"), and that workspace has no open report yet, so the preview defaults to "New report".

The three reports in the list are on W3 and W2. When you create from global create we list open reports from every workspace, so you can pick one of those, and that moves the expense to that workspace too. If the default workspace had an open report, the preview would show that report instead of "New report".

This matches what main does today. This PR doesn't change how the default report is picked.

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

Request changes - Blocker: QA step 7 doesn't match what the picker now shows. It lists only an outstanding report and "Create report", but there is now a "None" option, and QA runs the steps verbatim. Please add steps for None, the zero-report case, the locked cases and offline behavior.

The two 🟢 inline comments are small cleanups.

const ownerAccountID = reportOwnerAccountID ?? (isEditing ? undefined : session?.accountID);
const ownerPersonalDetails: CurrentUserPersonalDetails = {...getPersonalDetailsForAccountID(ownerAccountID, personalDetails), accountID: ownerAccountID ?? CONST.DEFAULT_NUMBER_ID};
const isPerDiemTransaction = isPerDiemRequest(transaction);
const isTimeTransaction = isTimeRequestUtil(transaction);

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.

🟢 isTimeTransaction is now defined here, but isTimeRequest in the returned props still calls isTimeRequestUtil(transaction) again. Can we reuse it there?

isTimeRequest: isTimeTransaction,

👁️ Written by AI, reviewed by Kevin.

// The form this page was opened from sits right below it in the stack and reads the expense type from its own route.
const setFormIOUType = (formIOUType: IOUType) => {
const {routes} = navigation.getState();
const formRoute = routes.at(routes.findIndex((stackRoute) => stackRoute.key === route.key) - 1);

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.

🟢 If route.key is the first route in the stack, findIndex(...) - 1 is -1 and .at(-1) returns the last route, which is not the form. Can we return early when the index is <= 0?

The formRoute.key === route.key check only covers the case where this page is the last route.

👁️ Written by AI, reviewed by Kevin.

@trjExpensify

Copy link
Copy Markdown
Contributor

@trjExpensify The expense is going to my default workspace (Dylandylan's Workspace, the one under "Create report"), and that workspace has no open report yet, so the preview defaults to "New report".

The three reports in the list are on W3 and W2. When you create from global create we list open reports from every workspace, so you can pick one of those, and that moves the expense to that workspace too. If the default workspace had an open report, the preview would show that report instead of "New report".

This matches what main does today. This PR doesn't change how the default report is picked.

Thanks for the explanation! 👍

trjExpensify
trjExpensify previously approved these changes Nov 11, 2026

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

👍

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

🟢 LGTM - Thanks for the updates, both of my remaining comments are fixed. Nothing else open from my side.

@melvin-bot
melvin-bot Bot requested a review from puneetlath November 11, 2026 08:05
@puneetlath
puneetlath merged commit 74643fe into Expensify:main Nov 11, 2026
40 of 42 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 9.5.37-0 🚀

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

@MelvinBot

MelvinBot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Help site update needed — Report > None adds a new, non-beta workflow for saving workspace expense drafts in personal space without a report.

Created a one-sentence update: Document saving workspace expense drafts without reports. The PR is draft, labeled HelpDot, and assigned to DylanDylann.

@DylanDylann, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review


view run · view recording

@mitarachim

Copy link
Copy Markdown

Deploy Blocker #106693 was identified to be related to this PR.

@mitarachim

Copy link
Copy Markdown

Deploy Blocker #106696 was identified to be related to this PR.

@jponikarchuk

Copy link
Copy Markdown

Deploy Blocker #106697 was identified to be related to this PR.

@jponikarchuk

Copy link
Copy Markdown

Deploy Blocker #106701 was identified to be related to this PR.

yusufdeveloper2903 pushed a commit to yusufdeveloper2903/App that referenced this pull request Nov 12, 2026
…01573-report-field-create-and-none"

This reverts commit 74643fe, reversing
changes made to f40710b.
@puneetlath

Copy link
Copy Markdown
Contributor

@DylanDylann @ikevin127 this was reverted FYI.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.37-1 🚀

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

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 9.5.38-0 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.5.39-2 🚀

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

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.

8 participants