Skip to content

Pass linkedTransaction to getReportPreviewMessage from the LHN - #104006

Merged
Julesssss merged 17 commits into
Expensify:mainfrom
linhvovan29546:refactor/66418-remove-getLinkedTransaction-in-getReportPreviewMessage
Nov 11, 2026
Merged

Julesssss merged 17 commits into
Expensify:mainfrom
linhvovan29546:refactor/66418-remove-getLinkedTransaction-in-getReportPreviewMessage

Conversation

@linhvovan29546

@linhvovan29546 linhvovan29546 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Part of the deprecatedAllTransactions cleanup. getReportPreviewMessage now takes the IOU action's transaction from its caller or from the report's own transactions, instead of the deprecated global.

  • Split (group chat) and track (self DM) actions: their transaction isn't part of the chat (reportID is SPLIT_REPORT_ID or unreported), so it can't come from allReportTransactions. These branches now use the linkedTransaction param, which the LHN already passes on main as lastActionTransaction (OptionRowLHNData subscribes to the last money request action's transaction and passes it through getOptionData → getReportAlternateText → getLastMessageTextForReport).
  • Expense/IOU reports (general path): the passed linkedTransaction is still used when it matches the action's IOUTransactionID. Otherwise the transaction is looked up in the report's own transactions with getLinkedTransaction(iouReportAction, allReportTransactions), since it belongs to report.
  • getLastMessageTextForReport: removed the lastAction ?? getLastVisibleAction(...) fallback and the !lastAction transaction thread lookup, and made lastAction required. Both callers (the LHN, and Search via resolveLastActionContext) already pass the lastAction they compute with getLastVisibleActionIncludingTransactionThread, so the fallback never found anything.
  • Search doesn't pass linkedTransaction yet, so split/track still fall back to the deprecated lookup when it's missing. Refactor/66418 pass linked transaction from search #104079 passes it from Search, and the fallback can be removed after that.

Fixed Issues

$ #66418
PROPOSAL: N/A

Tests

Split expense in a group chat

  1. Create a group chat with 2 or more members.
  2. Split an expense in it with a merchant (e.g. $10.00, "Lunch").
  3. Verify the LHN row for the group chat includes "split $10.00 for Lunch".

Track expense in the self DM

  1. Create an expense in your self DM with a merchant (e.g. $10.00, "Taxi").
  2. Verify the LHN row for the self DM includes "tracking $10.00 for Taxi".

Expense in a DM (regression check)

  1. Submit an expense to another user in a DM.
  2. Verify the LHN row shows the same preview as before this change.
  3. Submit a scanned receipt to the same user and verify the LHN row shows "Receipt scanning..." while it scans.

Search (regression check)

  1. Open the Search router and search for the group chat and the self DM above.
  2. Verify the results show the same split/track previews as the LHN.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests.

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

Android: Native
Android: mWeb Chrome
iOS: Native Simulator Screenshot - iPhone 17 Pro Max - 2026-10-15 at 18 21 47
iOS: mWeb Safari
Screen.Recording.2026-10-15.at.18.17.59.mov
MacOS: Chrome / Safari Screenshot 2026-10-15 at 15 58 48 Screenshot 2026-10-15 at 15 59 36

The general path now looks up the IOU action's transaction in the report's own
transactions via getLinkedIOUTransaction. Split and track actions keep their
transaction outside the report, so the LHN row reads it from Onyx and passes it
through getOptionData -> getReportAlternateText -> getLastMessageTextForReport.
Callers that don't pass it yet (Search) still fall back to the deprecated lookup.

Part of Expensify#66418
@linhvovan29546

Copy link
Copy Markdown
Contributor Author

@MelvinBot Review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

No blocking issues. The change looks correct, and CI is green except the two checklist checks.

I checked every caller of getReportPreviewMessage. Each one passes a report that owns the IOU action's transaction, so switching the general path to allReportTransactions keeps the same result (ReportUtils.ts:6633, ReportUtils.ts:6727). Search still falls back to the Onyx lookup because it doesn't pass linkedTransaction.

Suggestions:

  1. Narrow the LHN subscription (nit). OptionRowLHNData.tsx:111-112 subscribes for any money request action. The passed transaction is read only in the split and track branches (ReportUtils.ts:6554, ReportUtils.ts:6578). Use isSplitBillReportAction(lastAction) || isTrackExpenseAction(lastAction) instead. That avoids an extra transaction subscription and re-render for every IOU and expense report row.
  2. Add a test for the general path. The new tests cover split, track, and the Onyx fallback. None covers the lookup that now uses allReportTransactions. For example, add an IOU action in an IOU report with a scanning transaction, and expect the "receipt scanning" preview.
  3. Fill in the PR body. The summary sits above the template, so Explanation of Change is empty. Tests and QA Steps still have the // TODO placeholder. Fill them in, or add [No QA] to the title if this refactor needs no QA.

view run

@linhvovan29546
linhvovan29546 marked this pull request as ready for review October 15, 2026 11:22
@linhvovan29546
linhvovan29546 requested review from a team as code owners October 15, 2026 11:22
@melvin-bot
melvin-bot Bot requested a review from DylanDylann October 15, 2026 11:22
@melvin-bot

melvin-bot Bot commented Oct 15, 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 requested review from garrettmknight and removed request for a team October 15, 2026 11:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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 ⚠️ Failed 2026-10-15T11:51:37.612741Z bf75796 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.

Comment thread src/libs/ReportUtils.ts Resolved
Comment thread src/libs/ReportUtils.ts Resolved
@garrettmknight
garrettmknight removed their request for review October 19, 2026 08:55
Comment thread src/libs/ReportUtils.ts Outdated
convertToDisplayString: CurrencyListActionsContextType['convertToDisplayString'],
params: GetReportPreviewMessageBaseParams,
params: GetReportPreviewMessageBaseParams & {
linkedTransaction?: OnyxEntry<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.

Let's define linkedTransaction inside GetReportPreviewMessageBaseParams

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 in 7c9e85e. I also left it out of getReportPreviewReportActionMessage, which shares the type but doesn't use it.

Comment thread src/libs/ReportUtils.ts Outdated
// This covers group chats where the last action is a split expense action
const linkedTransaction = getLinkedTransaction(iouReportAction);
// The split transaction belongs to SPLIT_REPORT_ID, not to `report`, so it isn't in `allReportTransactions` and the caller has to pass it.
const linkedTransaction = getLinkedTransaction(iouReportAction, linkedTransactionParam ? [linkedTransactionParam] : undefined);

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.

Why do we need to use getLinkedTransaction function anymore?

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.

We still need it in this PR for two reasons:

  1. Search (OptionsListUtils → getReportAlternateText) doesn't pass linkedTransaction yet. When the param is undefined, getLinkedTransaction falls back to the Onyx lookup, so Search keeps showing split/track previews. Refactor/66418 pass linked transaction from search #104079 wires Search up.
  2. It checks that the passed transaction's ID matches the action's IOUTransactionID. That guards against the caller's last action differing from the one we're rendering.

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.

@linhvovan29546 I don’t think we should call getLinkedTransaction when linkedTransactionParam is already passed. I’m fine with keeping getLinkedTransaction as a fallback until the refactor is done.

About the IOUTransactionID check: could we do it when defining linkedTransactionParam instead?

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 in a49a9cb. getReportPreviewMessage now uses linkedTransactionParam ?? getLinkedTransaction(iouReportAction), so the Onyx lookup only runs as the fallback for Search until #104079. I moved the IOUTransactionID check to where linkedTransaction is passed in getLastMessageTextForReport, not OptionRowLHNData. That function can swap the rendered action for the parent's last action in one-transaction reports, so the check has to compare against the action that's actually rendered. I added a test for the mismatch case.

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.

@linhvovan29546 Oh, my bad. It’s actually better to use getLinkedTransaction as before. That was my mistake in the earlier review

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.

No worries, reverted in 7736c30. Both branches use getLinkedTransaction(iouReportAction, linkedTransactionParam ? [linkedTransactionParam] : undefined) again, and the extra guard in getLastMessageTextForReport is gone.

Comment thread src/libs/ReportUtils.ts Outdated
let linkedTransaction;
if (!isEmptyObject(iouReportAction) && shouldConsiderScanningReceiptOrPendingRoute && iouReportAction && isMoneyRequestAction(iouReportAction)) {
linkedTransaction = getLinkedTransaction(iouReportAction);
linkedTransaction = getLinkedTransaction(iouReportAction, allReportTransactions);

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 use linkedTransactionParam 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.

The LHN only passes linkedTransaction for split and track actions. We narrowed it in the earlier review to avoid a transaction subscription on every IOU/expense row. On this general path the IOU action's transaction belongs to report, so it's already in allReportTransactions. Looking it up there avoids both the deprecated global and an extra subscription. linkedTransactionParam would always be undefined here.

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.

@linhvovan29546 What’s your plan for removing allReportTransactions going forward? What do you think if we should pass allReportTransactions instead of linkedTransactionParam?

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.

Then linkedTransaction can be computed inside the function from allReportTransactions

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.

allReportTransactions alone can't replace it. Split transactions live under SPLIT_REPORT_ID and tracked ones are unreported, so neither is in the report's transactions. Removing getReportTransactions(report.reportID) here is a later step of #66418, where callers pass the report's transactions. That needs useReportTransactions per LHN row, so I'd keep it out of this PR. If you'd like, that PR can merge both into one transactions param and do the lookup inside.

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.

Checking again now

Comment thread src/libs/ReportUtils.ts Resolved
…-getLinkedTransaction-in-getReportPreviewMessage

# Conflicts:
#	src/libs/ReportAlternateTextUtils.ts
…-getLinkedTransaction-in-getReportPreviewMessage

# Conflicts:
#	src/components/LHNOptionsList/OptionRowLHN/OptionRowLHNData.tsx
#	src/libs/ReportAlternateTextUtils.ts
#	src/libs/ReportUtils.ts
#	src/libs/SidebarUtils.ts
… to getReportPreviewMessage

getReportPreviewMessage now uses the passed transaction directly and only
falls back to the Onyx lookup when none is passed.
@DylanDylann

Copy link
Copy Markdown
Contributor

Looks like our issue is the fallback when computing lastReportAction, which is why you were worried about computing the transaction from lastAction. I just checked the previous commits again, and it looks like we can safely remove this fallback. That way, we can simply compute linkedTransaction in the UI. Would love to hear your thoughts before moving forward

let lastReportAction = lastAction ?? getLastVisibleAction(reportID, canUserPerformWrite, {}, undefined, visibleReportActionsDataParam);

getReportPreviewMessage goes back to getLinkedTransaction, which already
matches the passed transaction against the action's IOUTransactionID.

Both callers of getLastMessageTextForReport (the LHN and Search) pass the
lastAction they computed with getLastVisibleActionIncludingTransactionThread,
so the getLastVisibleAction fallback never found anything. Tests that relied
on it now pass lastAction like the real callers do.
@linhvovan29546

Copy link
Copy Markdown
Contributor Author

@DylanDylann Agreed, and done in 7736c30. Both callers already pass lastAction from getLastVisibleActionIncludingTransactionThread: the LHN through SidebarUtils.getOptionData, and Search through resolveLastActionContext since #101298. So the lastAction ?? getLastVisibleAction(...) fallback and the !lastAction thread lookup never found anything. When lastAction is undefined, the parent-only lookup searches a subset of the same actions. I removed both and updated the tests that relied on them to pass lastAction like the real callers. Two tests seed a hidden action (a whisper, and a fraud alert for a read-only user), so they still pass no lastAction.

My earlier worry was actually the one-transaction block just below, which swaps an IOU CREATE/TRACK for the parent's last action. I kept that one, because removing it changes the LHN text for one-transaction expense/IOU reports. It doesn't affect this PR, though. It only runs when there's a transactionThreadReportID, which only exists for IOU, expense and invoice reports. The split and track branches that read linkedTransaction don't apply to those reports, so the transaction OptionRowLHNData computes from lastAction always matches the rendered action.

Comment thread src/libs/ReportAlternateTextUtils.ts Resolved
Comment thread src/libs/ReportUtils.ts Resolved
@DylanDylann

DylanDylann commented Oct 26, 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 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-10-26.at.12.11.30.mov

…-getLinkedTransaction-in-getReportPreviewMessage

# Conflicts:
#	src/components/LHNOptionsList/OptionRowLHN/OptionRowLHNData.tsx
#	src/libs/ReportUtils.ts
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/libs/ReportAlternateTextUtils.ts 92.85% <100.00%> (+0.21%) ⬆️
src/libs/ReportUtils.ts 90.77% <100.00%> (+0.32%) ⬆️
... and 6 files with indirect coverage changes

getReportPreviewMessage only falls back to getLinkedTransaction when no
transaction is passed, which is still the case for Search until Expensify#104079.
Also formats the Omit list re-added in the main merge.
@melvin-bot
melvin-bot Bot requested a review from Julesssss October 26, 2026 10:07
…-getLinkedTransaction-in-getReportPreviewMessage

# Conflicts:
#	src/components/LHNOptionsList/OptionRowLHN/OptionRowLHNData.tsx
#	src/libs/ReportAlternateTextUtils.ts
#	src/libs/ReportUtils.ts
@linhvovan29546

Copy link
Copy Markdown
Contributor Author

@MelvinBot Review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

No blocking issues. The code is correct, and every CI check passes except Check independent approval.

Things I checked:

  • Dropping the lastAction fallback is safe. Both callers compute lastAction with getLastVisibleActionIncludingTransactionThread, using the same data the fallback used. The LHN does this in OptionRowLHNData.tsx:185-191. Search does it in ReportAlternateTextUtils.ts:434. When lastAction is undefined, the fallback would also have found nothing. Making lastAction required matches this.
  • The general path finds the same transaction. getReportPreviewMessage has three callers, all in ReportAlternateTextUtils.ts. In each one, the IOU action's transaction belongs to reportOrID, so ReportUtils.ts:6838 and ReportUtils.ts:6942 return what the old lookup returned.
  • Split and track get the right transaction. The LHN passes the transaction of lastAction. The swap in the one-transaction block only runs for IOU, expense, and invoice reports, and the split and track branches don't handle those. So the unchecked use at ReportUtils.ts:6757 and ReportUtils.ts:6780 is safe.

Suggestions:

  1. Update the PR body. It says OptionRowLHNData adds a useOnyx that runs only for split and track actions, and that the PR adds a new param through getOptionData. That plumbing is already on main as lastActionTransaction, and it subscribes for any money request action (OptionRowLHNData.tsx:198-204). The body also leaves out two changes in this PR: removing the lastAction fallback and making lastAction required. Reviewers and QA will rely on the body.
  2. Nit: the new general-path test also passes on main. deprecatedAllTransactions and deprecatedReportsTransactions are filled by the same Onyx.connect (ReportUtils.ts:1171-1178), so "receipt scanning" shows either way. If you want the test to cover the switch, add a case where the transaction's reportID is a different report, and expect no merchant in the preview. This also means the general path still depends on that Onyx.connect, which the follow-up work will need to remove.

view run

…-getLinkedTransaction-in-getReportPreviewMessage
@linhvovan29546

Copy link
Copy Markdown
Contributor Author

@Julesssss could you take a look when you have a moment?

@Julesssss
Julesssss merged commit 1f33eb8 into Expensify:main Nov 11, 2026
38 of 39 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 Julesssss 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/Julesssss in version: 9.5.37-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR refactors how existing expense previews retrieve transaction data without adding a workflow, changing UI labels, removing a beta, or making existing article guidance incorrect.


view run

@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):

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