Skip to content

fix: Action button shows "Draft" for offline expense when approvals/payments are disabled#2

Open
RanuK12 wants to merge 653 commits into
mainfrom
ranukita/f5e7e7
Open

fix: Action button shows "Draft" for offline expense when approvals/payments are disabled#2
RanuK12 wants to merge 653 commits into
mainfrom
ranukita/f5e7e7

Conversation

@RanuK12

@RanuK12 RanuK12 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Details

When submitting an expense offline from the Search view (Reports > Expenses), the action button shows "Draft" instead of "Done" on workspaces with approvals and payments disabled. This happens because submitMoneyRequestOnSearch does not include an optimistic update for the report state (stateNum/statusNum).

Fixed Issues

Closes Expensify#93371

Tests

  1. Select "Track expenses for my business" during onboarding
  2. Have a workspace with approvals and payments disabled
  3. Go offline
  4. Navigate to Reports > Expenses
  5. Create a manual expense and submit it to workspace
  6. Verify the action button shows "Done" instead of "Draft"

QA Steps

Same as tests above.

Root Cause

submitMoneyRequestOnSearch calls API.write(SUBMIT_REPORT) without an optimistic update for the report state. When offline, the report remains OPEN/OPEN ("Draft") instead of transitioning to APPROVED/CLOSED ("Done") for submit-and-close policies.

Fix

Added optimistic data entries in submitMoneyRequestOnSearch that update each report's stateNum and statusNum to APPROVED/CLOSED (or SUBMITTED/SUBMITTED for non-submit-and-close policies) immediately in Onyx, before the API call completes.

ShridharGoel and others added 30 commits June 11, 2026 01:55
…GroupPolicy-submit

# Conflicts:
#	src/libs/ReportUtils.ts
#	src/libs/TransactionPreviewUtils.ts
#	src/libs/actions/IOU/MoneyRequestBuilder.ts
…/vendor

Onyx applies updates with shouldRemoveNestedNulls=true, so the optimistic
oldVendor: null (when adding a vendor with no prior) or vendor: null (when
clearing a vendor) was getting stripped on merge. The hasModifiedVendor
guard required BOTH keys to be present, so add/remove cases fell through
to the generic 'changed the expense' fallback instead of rendering
'set the vendor to X' / 'removed the vendor (previously X)'.

Loosen the guard to accept either key, and add tests covering add,
change, remove, and the QBO-deleted-vendor fallback, plus four
optimistic-action shape tests in UpdateMoneyRequestVendorTest.ts.
…tor rows

Allows users to remove themselves as a copilot from a delegator's account.
Adds RemoveDelegator write command, a confirmation modal, and replaces the
Switch button on delegator rows with a three-dot popover menu containing
Switch and Remove copilot access options.

Ref: Expensify/Expensify#638847
Co-authored-by: Daniel Gale-Rosen <dangrous@users.noreply.github.com>
- Run Prettier on Delegate.ts to fix formatting
- Convert delegatorMenuItems from useMemo to inline computation to fix
  React Compiler 'Cannot access refs during render' error. The compiler
  flags two useMemo hooks capturing callbacks that mutate the same ref.
  React Compiler auto-memoizes the inline computation, so manual useMemo
  is unnecessary.

Co-authored-by: Daniel Gale-Rosen <dangrous@users.noreply.github.com>
- Add removeDelegator field to DelegateErrors type
- Add removeCopilotAccess/removeCopilotAccessConfirmation translations
  to de, fr, it, ja, nl, pl, pt-BR, zh-hans
- Update CopilotPageTest to expect three-dot menu instead of Switch
  button in delegator rows
- Add removeDelegator to Delegate action mock

Co-authored-by: Daniel Gale-Rosen <dangrous@users.noreply.github.com>
- Update translations for remove copilot access in multiple languages (de, en, es, fr, it, ja, nl, pl, pt-BR, zh-hans) to include personalized confirmation messages.
- Modify CopilotPage to utilize new confirmation modal structure, including delegator name in prompts.
- Adjust icon usage in the delegator popover menu for improved UX.
- Add 'connect' and 'removeDelegator' fields to WithFieldName type for improved error tracking.
- Update error handling in removeDelegator function to provide more informative error messages.
- Modify CopilotPage to handle errors for both 'connect' and 'removeDelegator' actions, ensuring proper dismissal of errors on pending actions.
…ator row

- Convert showRemoveDelegatorModal and showDelegatorPopoverMenu to plain functions (React Compiler auto-memoizes)
- Remove role: CONST.ROLE.LINK from delegator row since it now opens a popover instead of navigating

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…belt baseline

Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
…r delegator type additions

Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
…r delegator type additions

Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
…utput

Co-authored-by: Christina Dobrzynski <Christinadobrzyn@users.noreply.github.com>
…ted summaries and update prompt display logic in AIRulesSection. This change allows for a more descriptive title to be shown, improving clarity for users.
…ule.title ?? rule.prompt` to ensure a fallback to prompt when title is not available, enhancing user clarity.
Cover title/prompt fallback, whitespace normalization, sort order,
pending-delete visibility online vs offline, and rule item / add
button navigation paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
grgia and others added 29 commits June 12, 2026 09:21
fix: Long tag names don't wrap in tag selection list
…zybowski/review-x-expenses

[Home Page] Add Review X expenses action to For you to surface expenses against company expense policy
…sh-window

SequentialQueue: await Onyx persist before allowing flush
…xtract-inbox-tab-button

refactor: extract InboxTabButton with colocated last report subs
…k-fix-another-debugmode-db

Fix fullScreenBlockingView bleeding over navigationTabBar (deploy blockers after debugTabView update)
…oup-headers

Add sticky group headers to Spend table (two-phase approach)
…ails-in-share-bank-recipients

Fix -  BA - Share button is visible for business bank account without workspace members
…fix-rock-fingerprint

[No QA] fix: add `patches` dirs to Rock fingerprint
…ek/app-8bm-sentry-crash-fix-nil-blobHandler

[No QA] Fix [Sentry: APP-8BM] HybridApp iOS NSInvalidArgumentException nil object in RCTNetworking prioritizedHandlers
fix Search - User in Recent chats section is not highlighted
…nnect-without-view

Move deleteReport to a separate file and use Onyx.connectWithoutView
…countCopy

[Payment due @dmkt9] Update Report suspicious activity copy to clarify when to lock an account
@RanuK12

RanuK12 commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

/claim

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.

[$250] Action button show as "Draft" for offline expense when approvals/payments are disabled