App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Message in IOU is not scrolled to when navigating via link, "submitted" not shown

Open nlemma opened this issue 8 months ago • 111 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.3.51-5 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/86719 step 2 in Re-fetch triggers Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: iPhone 15 iOS 26.3.1 App Component: Other

Action Performed:

  1. Sign in to ND as User A on the main testing device, and User B on secondary device
  2. As User A, create a workspace, add User B as a member
  3. As User B, navigate to the workspace chat
  4. Create a manual expense, open expense details, click Submit button
  5. Send three messages in the expense details
  6. Right click on the 3rd message - Copy link - send the link in 1:1 chat with User A
  7. As User A, open 1:1 chat with User B, tap the link from step 6

Expected Result:

The linked message is scrolled to

Actual Result:

User is navigated to the expense details, but the message is not scrolled to (happens, when navigating for the first time). "Submitted" system message does not appear in the expense details thread when navigating via another message link.

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [x] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [ ] MacOS: Chrome / Safari

Screenshots/Videos

https://github.com/user-attachments/assets/3aab7f41-3589-4a66-8c72-ac2268f0226a

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @abbasifaizan70
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022039454831347450891
  • Upwork Job ID: 2039454831347450891
  • Last Price Increase: 2026-07-08

nlemma avatar Apr 01 '26 21:04 nlemma

Proposal

What is the root cause of that problem?

When navigating to an IOU/expense thread via a copied message link, the ReportFetchHandler component at src/pages/inbox/ReportFetchHandler.tsx:159-164 has an effect that detects "one-transaction threads" and immediately clears reportActionID from the route params:

useEffect(() => {
    if (!transactionThreadReportID || !route?.params?.reportActionID || !isOneTransactionThread(childReport, report, linkedAction)) {
        return;
    }
    navigation.setParams({reportActionID: ''});
}, [transactionThreadReportID, route?.params?.reportActionID, linkedAction, ...]);

This has two consequences:

  1. Scroll-to fails: The reportActionID is used as initialScrollKey in the InvertedFlatList (ReportActionsList.tsx:902). When cleared, the FlatList remounts without a scroll anchor and renders from the newest message instead of the linked one.

  2. "Submitted" disappears: The main fetch effect at ReportFetchHandler.tsx:224-229 depends on reportActionIDFromRoute. When that is cleared to '', it re-triggers openReport without a reportActionID, causing the server to return the newest page of actions rather than actions centered around the linked message. The "Submitted" system action, which is a separate report action in the timeline, may be chronologically outside this newest page and not included in the returned data. Additionally, usePaginatedReportActions returns only the continuous page chain -- so the "Submitted" action falls outside the displayed window.

This issue was likely exacerbated by PR #86719 ("decompose ReportScreen 6b: extract fetch controller"), which moved this clearing effect from ReportScreen into the separate ReportFetchHandler child component. Previously, the clearing effect and the scroll/linking logic all ran in the same component (ReportScreen) within the same render cycle. Now they run in separate sibling components (ReportFetchHandler vs ReportActionsView), introducing a timing gap where reportActionID can be cleared before the scroll-to-linked-message logic in ReportActionsView has a chance to position the list.

What changes do you think we should make in order to solve the problem?

The one-transaction-thread effect at ReportFetchHandler.tsx:159-164 should not clear reportActionID when the linked message belongs to the transaction thread that the one-transaction view is about to display inline. Instead, the reportActionID should be preserved so that:

  1. The initialScrollKey in ReportActionsList/MoneyRequestReportActionsList can position the list at the linked message.
  2. The openReport API call retains the reportActionID so the server returns the correct page of actions around the linked message (including "Submitted").

The fix should modify the effect to only clear reportActionID when the user is navigating to a one-transaction thread and the linked action is the IOU parent action itself (which gets expanded into the transaction thread view), not when the linked action is a comment or system message within that thread.

What alternative solutions did you explore? (Optional)

An alternative would be to delay clearing reportActionID until after the scroll-to-linked-message logic has completed (e.g., using a ref or callback to signal completion). However, this would add unnecessary complexity -- the simpler approach is to not clear the reportActionID when it points to a message that will be displayed in the combined one-transaction view.


Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

Cat fact: Cats have a specialized collarbone that allows them to always land on their feet -- they can rotate their spine mid-fall at up to 100 RPM.

MelvinBot avatar Apr 01 '26 21:04 MelvinBot

Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

melvin-bot[bot] avatar Apr 01 '26 21:04 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022039454831347450891

melvin-bot[bot] avatar Apr 01 '26 21:04 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

When opening an IOU message link (copied from inside expense details), the app navigates to the expense details thread but does not reliably scroll to the linked message on first open, and the "Submitted" system message can be missing from the loaded thread window.

What is the root cause of that problem?

The route reportActionID (used as the link anchor) is being cleared too early in one-transaction-thread navigation.

In ReportScreen, when the destination is detected as a one-transaction thread, this effect clears reportActionID immediately: https://github.com/Expensify/App/blob/1d43910cc609b687312a6ea523b703579b201e6d/src/pages/inbox/ReportScreen.tsx#L427-L432

But reportActionIDFromRoute is also passed into openReport(...) as the server fetch anchor: https://github.com/Expensify/App/blob/1d43910cc609b687312a6ea523b703579b201e6d/src/pages/inbox/ReportScreen.tsx#L563-L563

And it is used as initialScrollKey for the action list: https://github.com/Expensify/App/blob/1d43910cc609b687312a6ea523b703579b201e6d/src/pages/inbox/report/ReportActionsList.tsx#L868-L868

So clearing it before initial load/positioning removes both:

  1. the fetch focus around the linked action, and
  2. the first-render scroll anchor to the linked action.

This matches the observed behavior from the issue media: the linked "Message 3" appears, but "Submitted" is not in the initially loaded window when entering via the link.

What changes do you think we should make in order to solve the problem?

  1. In one-transaction-thread link flows, do not clear reportActionID immediately on mount.
  2. Keep reportActionID until initial linked-action positioning is complete (or until we confirm the linked action is visible), then clear it if needed for cleanup.
  3. Scope this logic to link-navigation paths only so normal non-link report opening behavior is unchanged.
  4. Add regression coverage for: copy link from an expense-thread message -> open link from 1:1 -> verify first open lands on linked message and still includes adjacent system actions like "Submitted" in the loaded timeline.

What alternative solutions did you explore? (Optional)

  • Removing the one-transaction-thread reportActionID cleanup entirely would reduce this bug but risks stale route param side effects in other flows.
  • A safer fix is deferred cleanup (after anchor usage), not immediate cleanup before fetch/scroll anchoring.

KJ21-ENG avatar Apr 01 '26 21:04 KJ21-ENG

Contributor details:

  • Name: Sean Ideozu
  • Upwork profile: https://www.upwork.com/freelancers/bosscos
  • Email: [email protected]

Proposal

Root cause:

This is a regression from PR #86719 (Re-fetch triggers). When navigating to an IOU report via a notification link or deep-link, ReportActionsView triggers a re-fetch of report actions. The scroll-to-linked-message logic runs on initial mount but does not re-run after the re-fetch completes — the list settles at default position (bottom or unread) rather than scrolling to the linked action.

Additionally, the submitted action (IOU with originalMessage.type === 'submit') may not render its label after the re-fetch resets the list, since the initial viewport position is not preserved through the loading cycle.

Files involved:

  • src/pages/home/report/ReportActionsView.tsx — re-fetch lifecycle + scroll-to trigger
  • src/components/ReportActionsList.tsx — scrollToIndex ref timing
  • src/libs/ReportUtils.ts — getIOUReportActionMessage "submitted" label

Proposed fix:

  1. In ReportActionsView.tsx, preserve the linkedReportActionID target through the re-fetch cycle. After the re-fetch loading state clears (when isLoading transitions true → false), re-trigger the scroll-to-index call with the same target instead of only running it on mount.
  2. Prevent initialScrollIndex from being reset by the re-fetch loading state — gate the reset on linkedReportActionID being absent, not just on loading completing.
  3. Ensure the "submitted" IOU action renders in the visible viewport once the scroll lands — the getIOUReportActionMessage logic is correct but the render is skipped when the action is outside the initial viewport post-re-fetch.

Impact: All platforms (iOS confirmed in issue). Single lifecycle fix in ReportActionsView.tsx scroll trigger.

bossco7598 avatar Apr 01 '26 21:04 bossco7598

🚨 Edited by proposal-police: This proposal was edited at 2026-07-05 06:54:36 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

When navigating to an expense details thread via a copied message link, the "Submitted" system message does not appear and the linked message may not be scrolled to correctly.

What is the root cause of that problem?

When a user copies a message link from the one-transaction combined view (parent IOU report with the transaction thread inlined), the link URL points to the transaction thread report — not the parent IOU report. This is because getOriginalReportID resolves the action's owning report to the transaction thread when the comment isn't found in the parent's raw Onyx actions.

When another user taps this link, they navigate directly to the transaction thread report (type CHAT). In useTransactionThread, getOneTransactionThreadReportID is called to determine whether to merge parent actions, but getOneTransactionThreadReportAction immediately rejects reports whose type is not IOU, EXPENSE, or INVOICE.

Since the transaction thread has type CHAT, the function returns undefined. This means getCombinedReportActions in useReportActionsPagination receives null as the transaction thread ID and returns only the transaction thread's own actions — without merging the parent IOU report's actions.

The "Submitted" system message is a SUBMITTED report action stored in the parent IOU report, not in the transaction thread. So it is never included in the displayed action list when viewing the thread directly.

What changes do you think we should make in order to solve the problem?

In useReportActionsPagination, when the current report is a transaction thread, detect whether it belongs to a one-transaction parent IOU report by checking from the parent's perspective. Load the parent IOU report (via parentReportID) and its actions, then call getOneTransactionThreadReportID from the parent's perspective to confirm this thread is the sole transaction thread. If so, reverse the merge direction in getCombinedReportActions — passing the parent's actions as the base and the current thread's actions as the child. This ensures system messages like "Submitted" from the parent IOU report appear in the combined view, matching the behavior when the user navigates to the parent IOU report directly.

The linked reportActionID continues to live in the child thread's own actions, so pagination and scroll-to-message keep working unchanged.

What alternative solutions did you explore? (Optional)

  1. Change getOriginalReportID to return the parent IOU report ID — this would make the copied link point to the parent report. However, the reportActionID in the link belongs to the transaction thread, and the server's openReport for the parent wouldn't return actions centered around an action from a different report. The pagination would break.

  2. Redirect from the transaction thread to the parent IOU report in ReportFetchHandler — this would navigate the user to the parent, showing the combined view. The URL change succeeds, but LinkedActionNotFoundGuard then runs against the parent and looks up the actionID in the parent's own raw actions only — the chat comment lives only in the child thread, so the lookup fails and the page renders "The comment you are looking for cannot be found." This approach would require additionally teaching the not-found guard to search merged actions, which expands the change footprint and risks regressions.

The chosen approach (reverse-merging parent actions in useReportActionsPagination when viewing a one-transaction thread) keeps the change minimal, preserves the correct pagination/scroll behavior for the linked message, and surfaces the parent's system messages.

Compare link: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/86919-iou-message-not-scrolled

wildan-m avatar Apr 01 '26 21:04 wildan-m

🚨 Edited by proposal-police: This proposal was edited at 2026-04-27 17:35:24 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

When navigating to an expense-details thread via a copied message link:

  • the linked message is not scrolled to on first navigation, and
  • the "Submitted" system message does not appear in the expense-details thread.

What is the root cause of that problem?

There are three cooperating causes, not just one:

1. The copied link uses originalReportID

In one-transaction expense flows this resolves to the transaction-thread report ID. Opening that URL lands in the transaction-thread route, so parent-level actions like "Submitted" never appear (they live on the parent expense report, not on the transaction thread).

// App/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
onPress: (closePopover, {reportAction, originalReportID}) => {
    getEnvironmentURL().then((environmentURL) => {
        const reportActionID = reportAction?.reportActionID;
        Clipboard.setString(`${environmentURL}/r/${originalReportID}/${reportActionID}`);
    });
    hideContextMenu(true, ReportActionComposeFocusManager.focus);
},

2. LinkedActionNotFoundGuard only searches the route's report

Even after fixing (1) by switching the link to the displayed (parent) report ID, the guard only looks up the linked action in the route's report's REPORT_ACTIONS collection. The chat message the user copied actually lives in the transaction-thread's REPORT_ACTIONS, so the lookup returns undefined and a "comment not found" page is shown.

// App/src/pages/inbox/LinkedActionNotFoundGuard.tsx
const [linkedAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportIDFromRoute}`, {
    selector: (actions: OnyxEntry<ReportActions>) => getReportActionByIDSelector(actions, reportActionIDFromRoute),
});

3. usePaginatedReportActions returns empty data when the action is in a sibling report

PaginationUtils.getContinuousChain returns an empty data array when the requested reportActionID isn't present in the report's own actions:

// App/src/libs/PaginationUtils.ts
// If we found an item with the resource id, we want link to the specific page with the item
if (id) {
    // If we are searching for an item with a specific resource id and
    // we are linking to an action that doesn't exist in Onyx, return an empty array
    if (!didFindItem) {
        return {data: [], hasNextPage: false, hasPreviousPage: false, resourceItem};
    }

In one-transaction expense flows, parent-level actions and transaction-thread actions are merged for display in ReportActionsView, but the linked action ID typically belongs to the transaction-thread side. With the empty-data fallback, the parent's "Submitted" action is never rendered and there's nothing to scroll to.

What changes do you think we should make in order to solve the problem?

Three small, targeted changes. The first is the original proposal idea; the second and third are required to make it actually work end-to-end.

A. Generate the copied link with the displayed report ID

One-transaction expense links always open in the parent expense context.

// App/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
onPress: (closePopover, {reportAction, originalReportID, isOffline}) => {
    getEnvironmentURL().then((environmentURL) => {
        const reportActionID = reportAction?.reportActionID;
        const reportID = originalReportID ? getDisplayedReportID(originalReportID, isOffline) : originalReportID;
        Clipboard.setString(`${environmentURL}/r/${reportID}/${reportActionID}`);
    });
    hideContextMenu(true, ReportActionComposeFocusManager.focus);
},

B. Make LinkedActionNotFoundGuard aware of the merged one-transaction context

When the route's report is the displayed parent expense, also look up the linked action in the transaction-thread's actions before deciding it's missing:

// App/src/pages/inbox/LinkedActionNotFoundGuard.tsx
const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? {}, isOffline);
const [linkedActionInTransactionThread] = useOnyx(
    `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(transactionThreadReportID)}`,
    {
        selector: (actions: OnyxEntry<ReportActions>) => getReportActionByIDSelector(actions, reportActionIDFromRoute),
    },
    [reportActionIDFromRoute],
);

const linkedAction = linkedActionInRoute ?? linkedActionInTransactionThread;

C. Make usePaginatedReportActions fall back gracefully when the linked action is in a sibling/child report

When a reportActionID is supplied but doesn't exist in this report's own actions, fall back to the latest page so the host screen can still render its own actions and merge in the sibling/child report's actions (this is what surfaces "Submitted" and what ReportActionsList's initialScrollKey then anchors to):

// App/src/hooks/usePaginatedReportActions.ts
const id = useMemo(() => {
    if (reportActionID) {
        const isInThisReport = sortedAllReportActions?.some((action) => action.reportActionID === reportActionID) ?? false;
        return isInThisReport ? reportActionID : undefined;
    }
    // ...existing oldest-unread logic unchanged
}, [reportActionID, shouldLinkToOldestUnreadReportAction, sortedAllReportActions]);

Result with all three changes

  • Link no longer hits "page not found".
  • Parent expense context opens with the full timeline ("Submitted" system message included).
  • The transaction-thread chat messages are merged in, so initialScrollKey={linkedReportActionID} scrolls to the linked message on first navigation.

Known trade-off (UX note)

On the first navigation via the link, there is a brief loading window: the parent expense report's actions and the transaction-thread's actions are both fetched/streamed from Onyx before the merged list is fully populated, after which the FlatList anchors to the linked message via initialScrollKey. In practice this is the same loading cost any deep-linked report incurs; it's no longer than a normal cold-open of the same expense from the LHN, and subsequent visits are instant because both reports are now hydrated.

If we want to make this feel faster, we can additionally pass reportActionID into openReport for the transaction-thread (so the server returns the page containing the linked action immediately) — happy to add that as a follow-up if reviewers want it bundled in.

What alternative solutions did you explore?

  • Keeping the link as originalReportID (transaction-thread) and fixing the loading path so the parent's "Submitted" action and pagination work in the thread route. This required spreading parent-context awareness into the transaction-thread render path, which is a larger and more invasive change than (A) + (B) + (C) above.
  • Only changing (A) per the original proposal. This produces a "page not found" page because (B) and (C) aren't satisfied (verified by direct testing).

Test branch

Link

abbasifaizan70 avatar Apr 01 '26 23:04 abbasifaizan70

⚠️ @abbasifaizan70 Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

github-actions[bot] avatar Apr 01 '26 23:04 github-actions[bot]

🚨 Edited by proposal-police: This proposal was edited at 2026-04-02 05:19:15 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

When a user opens a copied link to a message inside a single-transaction IOU/expense thread for the first time, the app opens the report but does not scroll to the linked message, and the combined one-transaction timeline is incomplete, so parent actions like Submitted are missing.

What is the root cause of that problem?

The main issue is that when the user opens the message link for the first time, the app tries to scroll to that message before the report actions have finished loading. At that moment, the linked message is not in the list yet, so the initial scroll has nothing to scroll to and gets missed. A moment later, the messages finish loading and the linked message appears, but the app does not try the scroll again. That is why it fails on the first open, but works on later tries after the messages are already loaded locally.

Video demo of the root cause:

https://github.com/user-attachments/assets/212d9505-47e4-44ed-ae10-88d7e9f6bb6a

There are 2 bugs in the same deeplink flow.

  1. We open the child transaction thread, but we do not rebuild the parent + child combined one-transaction view from that entry point. The copied link is built from originalReportID in ContextMenuActions.tsx. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx#L1187-L1190 getOriginalReportID() returns the transaction-thread report ID when the clicked action is not present in the parent report’s raw action collection in ReportUtils.ts. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/libs/ReportUtils.ts#L10390-L10403 Then, in ReportActionsView.tsx and ReportActionsView.tsx, we only read actions for the current reportID and combine them with transactionThreadReportActions derived from the current report. That works when the current report is the parent IOU/expense report, but not when the current report is already the child CHAT transaction thread. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsView.tsx#L83-L85 https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsView.tsx#L241-L250 getOneTransactionThreadReportID() only recognizes IOU/EXPENSE/INVOICE reports in ReportActionsUtils.ts, so once we enter through the child CHAT thread, the parent merge path is skipped and parent actions like Submitted are never added. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/libs/ReportActionsUtils.ts#L1846-L1922

  2. The linked-message scroll is only initialized on the first mount, before the linked action exists locally. ReportActionsList.tsx always passes initialScrollKey={reportActionID}. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsList.tsx#L900-L902 useFlatListScrollKey.ts snapshots the initial anchor from whatever data exists on first render. On a cold open, the linked action is not loaded yet, so currentDataIndex is -1 and isInitialData starts false. When the linked action arrives later from openReport, the hook does not re-arm the initial scroll, so the first open misses the scroll. Later opens work because the action is already cached. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/components/FlatList/hooks/useFlatListScrollKey.ts#L46-L53

What changes do you think we should make in order to solve the problem?

In ReportFetchHandler.tsx, we currently fetch only the route report. We should also fetch the parent IOU/expense/invoice report when a deeplink opens a child transaction thread, without waiting on isOneTransactionThread(), because that check itself depends on parent data being loaded. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/ReportFetchHandler.tsx#L81-L164

diff --git a/src/pages/inbox/ReportFetchHandler.tsx b/src/pages/inbox/ReportFetchHandler.tsx
@@
-import {
-    getReportTransactions,
-    isChatThread,
-    isHiddenForCurrentUser,
-    isOneTransactionThread,
-    isPolicyExpenseChat,
-    isReportTransactionThread,
-    isTaskReport,
-    isValidReportIDFromPath,
-} from '@libs/ReportUtils';
+import {
+    getReportTransactions,
+    isChatThread,
+    isHiddenForCurrentUser,
+    isInvoiceReport,
+    isMoneyRequestReport,
+    isOneTransactionThread,
+    isPolicyExpenseChat,
+    isReportTransactionThread,
+    isTaskReport,
+    isValidReportIDFromPath,
+} from '@libs/ReportUtils';
@@
 const reportID = reportOnyx?.reportID;
 const report = reportOnyx;
+const parentReportID = getNonEmptyStringOnyxID(report?.parentReportID);
+const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`);
+const [parentReportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${parentReportID}`);
@@
 const isTransactionThreadView = isReportTransactionThread(report);
+const shouldLoadParentReportActions =
+    !!reportActionIDFromRoute && isChatThread(report) && !!parentReportID && (!parentReport?.reportID || isMoneyRequestReport(parentReport) || isInvoiceReport(parentReport));
@@
+useEffect(() => {
+    if (!shouldLoadParentReportActions || parentReportMetadata?.hasOnceLoadedReportActions || parentReportMetadata?.isLoadingInitialReportActions) {
+        return;
+    }
+
+    openReport({reportID: parentReportID, introSelected, betas});
+}, [shouldLoadParentReportActions, parentReportID, parentReportMetadata?.hasOnceLoadedReportActions, parentReportMetadata?.isLoadingInitialReportActions, introSelected, betas]);

This keeps the fix local to the deeplink fetch flow and guarantees the parent actions are available in Onyx for the combined view.

In ReportActionsView.tsx, we currently read only the current report actions, combine only from the current-report perspective, and mount the list even when the linked action is still missing. We should replace that with parent-action loading for child-thread entry, combined parent+child rendering, and a small linked-action readiness gate. https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsView.tsx#L83-L85 https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsView.tsx#L241-L250 https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsView.tsx#L404-L410

diff --git a/src/pages/inbox/report/ReportActionsView.tsx b/src/pages/inbox/report/ReportActionsView.tsx
@@
 import {
     buildOptimisticCreatedReportAction,
     buildOptimisticIOUReportAction,
     canUserPerformWriteAction,
+    isChatThread,
     isConciergeChatReport,
     isInvoiceReport,
     isMoneyRequestReport,
+    isOneTransactionThread,
     isReportTransactionThread as isReportTransactionThreadUtil,
 } from '@libs/ReportUtils';
@@
 const parentReportAction = useParentReportAction(report);
+const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`);
+const shouldReadParentReportActions = isChatThread(report) && !!parentReport?.reportID && (isMoneyRequestReport(parentReport) || isInvoiceReport(parentReport));
+const {reportActions: unfilteredParentReportActions} = usePaginatedReportActions(shouldReadParentReportActions ? parentReport.reportID : undefined);
+const parentReportActions = useMemo(() => getFilteredReportActionsForReportView(unfilteredParentReportActions), [unfilteredParentReportActions]);
@@
 const isReportTransactionThread = isReportTransactionThreadUtil(report);
+const isOneTransactionThreadReport = useMemo(() => isOneTransactionThread(report, parentReport, parentReportAction, isOffline), [report, parentReport, parentReportAction, isOffline]);
@@
-const reportActions = useMemo(
-    () => (reportActionsToDisplay ? getCombinedReportActions(reportActionsToDisplay, transactionThreadReportID ?? null, transactionThreadReportActions ?? []) : []),
-    [reportActionsToDisplay, transactionThreadReportActions, transactionThreadReportID],
-);
-
-const parentReportActionForTransactionThread = useMemo(
-    () => (isEmptyObject(transactionThreadReportActions) ? undefined : allReportActions?.find((action) => action.reportActionID === transactionThreadReport?.parentReportActionID)),
-    [allReportActions, transactionThreadReportActions, transactionThreadReport?.parentReportActionID],
-);
+const parentReportActionsToDisplay = useMemo(
+    () => parentReportActions.map((action) => (action.reportID || !parentReport?.reportID ? action : {...action, reportID: parentReport.reportID})),
+    [parentReportActions, parentReport?.reportID],
+);
+
+const currentReportActionsToDisplay = useMemo(
+    () => reportActionsToDisplay.map((action) => (action.reportID || !report?.reportID ? action : {...action, reportID: report.reportID})),
+    [reportActionsToDisplay, report?.reportID],
+);
+
+const transactionThreadReportForList = isOneTransactionThreadReport ? report : transactionThreadReport;
+
+const reportActions = useMemo(() => {
+    const reportActionsBase = isOneTransactionThreadReport ? parentReportActionsToDisplay : reportActionsToDisplay;
+    const currentTransactionThreadReportID = isOneTransactionThreadReport ? (report?.reportID ?? null) : (transactionThreadReportID ?? null);
+    const currentTransactionThreadReportActions = isOneTransactionThreadReport ? currentReportActionsToDisplay : (transactionThreadReportActions ?? []);
+
+    return getCombinedReportActions(reportActionsBase, currentTransactionThreadReportID, currentTransactionThreadReportActions, reportActionsBase.at(0)?.reportID);
+}, [currentReportActionsToDisplay, isOneTransactionThreadReport, parentReportActionsToDisplay, report?.reportID, reportActionsToDisplay, transactionThreadReportActions, transactionThreadReportID]);
+
+const parentReportActionForTransactionThread = useMemo(() => {
+    if (isOneTransactionThreadReport) {
+        return parentReportAction;
+    }
+    if (isEmptyObject(transactionThreadReportActions)) {
+        return undefined;
+    }
+    return allReportActions?.find((action) => action.reportActionID === transactionThreadReport?.parentReportActionID);
+}, [isOneTransactionThreadReport, parentReportAction, allReportActions, transactionThreadReportActions, transactionThreadReport?.parentReportActionID]);
@@
-const hasNewestReportAction = isNewestAction(lastActionCreated, report?.lastVisibleActionCreated) || isNewestAction(lastActionCreated, transactionThreadReport?.lastVisibleActionCreated);
+const hasNewestReportAction =
+    isNewestAction(lastActionCreated, report?.lastVisibleActionCreated) || isNewestAction(lastActionCreated, transactionThreadReportForList?.lastVisibleActionCreated);
+const hasLinkedActionLoaded = !reportActionID || reportActions.some((action) => action.reportActionID === reportActionID);
@@
-const shouldShowSkeleton = shouldShowSkeletonForConciergePanel || shouldShowSkeletonForInitialLoad || shouldShowSkeletonForAppLoad;
+const shouldShowSkeletonForLinkedMessage = !!reportActionID && !hasLinkedActionLoaded && !isOffline;
+const shouldShowSkeleton = shouldShowSkeletonForConciergePanel || shouldShowSkeletonForInitialLoad || shouldShowSkeletonForAppLoad || shouldShowSkeletonForLinkedMessage;
@@
-transactionThreadReport={transactionThreadReport}
+transactionThreadReport={transactionThreadReportForList}

This does 3 things:

  1. It makes the child-thread deeplink render the same combined one-transaction timeline as the parent IOU/expense view, so Submitted stays visible.
  2. It preserves each action’s owning reportID, so the existing visibility filters keep working correctly after the parent and child actions are combined.
  3. It prevents ReportActionsList from mounting until the linked action exists in the final rendered action set, so the existing initialScrollKey logic works on the first open without changing the generic flat-list hook.

Video demo of the fix:

https://github.com/user-attachments/assets/9a66f8b5-3134-4c9c-bd62-3db03bd9de14

What alternative solutions did you explore? (Optional)

nabi-ebrahimi avatar Apr 02 '26 04:04 nabi-ebrahimi

⚠️ @nabi-ebrahimi Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

github-actions[bot] avatar Apr 02 '26 04:04 github-actions[bot]

Proposal

What is the root cause of that problem?

User is navigated to the expense details, but the message is not scrolled to (happens, when navigating for the first time):

  1. From user A's side, the CREATED action of the transaction thread report isn't loaded for the first time. Then, after this action is returned via OpenReport API, this useEffect is fired, which causes the list scroll to the first action (CREATED) because it's the Inverted FlatList. That also explains why it only happens for the first time.

https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsList.tsx#L383-L390

"Submitted" system message does not appear in the expense details thread when navigating via another message link.

  1. When we're in the one-expense report and add a message, the message is added to the transaction thread report. Then the copied link is linked to the transaction thread instead of the one-expense report. That means Submitted system message doesn't appears is the expected because it's the system message action of the expense report.

What changes do you think we should make in order to solve the problem?

Based on the RCA, we only need to fix the first problem, which is that the report is scrolled to the top. To fix this, we should check if we're linked to a report action; we shouldn't trigger the scroll here. This is the same pattern we set up for shouldScrollToEndAfterLayout here

const shouldTriggerScroll = shouldFocusToTopOnMount && prevHasCreatedActionAdded && !hasCreatedActionAdded && !reportActionID;

https://github.com/Expensify/App/blob/e38712f470a43a522ac7d66ff928087a0dd59b86/src/pages/inbox/report/ReportActionsList.tsx#L383-L390

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

nkdengineer avatar Apr 02 '26 10:04 nkdengineer

⚠️ @nkdengineer Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

github-actions[bot] avatar Apr 02 '26 10:04 github-actions[bot]

@abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Apr 07 '26 21:04 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Apr 08 '26 16:04 melvin-bot[bot]

@abdulrahuman5196 Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Apr 09 '26 21:04 melvin-bot[bot]

@abdulrahuman5196 10 days overdue. I'm getting more depressed than Marvin.

melvin-bot[bot] avatar Apr 13 '26 21:04 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Apr 15 '26 16:04 melvin-bot[bot]

@abdulrahuman5196 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Apr 15 '26 21:04 melvin-bot[bot]

@abdulrahuman5196 12 days overdue. Walking. Toward. The. Light...

melvin-bot[bot] avatar Apr 15 '26 21:04 melvin-bot[bot]

This issue has not been updated in over 14 days. @abdulrahuman5196 eroding to Weekly issue.

melvin-bot[bot] avatar Apr 20 '26 21:04 melvin-bot[bot]