Skip to content

[LegendList 5/9] refactor: prepare report list refs and recycled row state - #104978

Draft
chrispader wants to merge 1 commit into
Expensify:mainfrom
margelo:@chrispader/refactor/legend-list-row-preparation
Draft

chrispader wants to merge 1 commit into
Expensify:mainfrom
margelo:@chrispader/refactor/legend-list-row-preparation

Conversation

@chrispader

@chrispader chrispader commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Message rows can be reused for another action, and the shared list ref still describes a legacy FlatList. This PR adds a common ref contract and prepares row and preview state for reuse. It also lets money reports finish edit scrolling after the list layout commits.

@roryabraham @dmkt9

Explanation of Change

This is layer 5 of the nine-part LegendList series, extracted from #100733. It is independent of layer 4. The main chat continues to use inverted FlashList; layer 6 introduces LegendList rendering. A temporary type export keeps the existing FlashList wrapper compatible until that migration removes it. Closing an edit in the main chat now calls the scroll manager's scrollToBottom instead of scrollToIndex(0), so on web the list jumps to the newest message instead of animating.

Review and merge order: nine-part LegendList rollout. Layers 4 and 5 are independent preparations; merge both before layer 6.

Fixed Issues

$ #98994

Part of the migration split from #98270. No approved proposal is linked.

Tests

All platforms means desktop web, mobile web, Android, and iOS.

All platforms, attachment previews after scrolling

  1. Open a chat with scrollable history.
  2. Send a portrait image.
  3. Send a landscape image.
  4. Send a PDF.
  5. Scroll until those attachments are off-screen.
  6. Scroll back to the attachments. Each preview should still match its file and keep the correct proportions.
  7. Open the PDF. The document you sent should open.

All platforms, switching expense reports

  1. Open an expense report. Note its amount and receipt preview.
  2. Return to the chat.
  3. Open a different expense report. Its amount and receipt preview should belong to the second report.

All platforms, save a short expense-report comment

  1. Open an expense report where you can leave comments.
  2. Send the comment one.
  3. Open that comment's action menu.
  4. Choose Edit.
  5. Replace the text with two.
  6. Save the edit. The newest comment should remain visible without a blank area at the bottom.

All platforms, cancel an expense-report comment edit

  1. Open an expense report where you can leave comments.
  2. Send the comment Keep me.
  3. Open that comment's action menu.
  4. Choose Edit.
  5. Change the comment text.
  6. Cancel the edit. The original comment should remain visible at the bottom.

All platforms, delete a comment through the editor

  1. Open an expense report where you can leave comments.
  2. Send the comment Delete me.
  3. Open that comment's action menu.
  4. Choose Edit.
  5. Clear the comment text.
  6. Save the empty edit. A delete confirmation should appear.
  7. Confirm deletion. The list should show its newest remaining message.

All platforms, edit the newest chat message

  1. Open a chat.
  2. Send a short message.
  3. Open that message's action menu.
  4. Choose Edit.
  5. Change the message text.
  6. Save the edit. The updated message should remain visible at the bottom.

All platforms, repeated link previews

  1. Open a chat with scrollable history.
  2. Send a URL that produces a link preview.
  3. Send the same URL in another message. Both messages should have their own preview.
  4. Scroll the two messages off-screen.
  5. Scroll back to them. Each preview should remain attached to its message.
  • Verify that no errors appear in the JS console

Offline tests

All platforms, save a cached comment offline

  1. Open an expense report where you can leave comments while online.
  2. Send the comment Offline edit.
  3. Disconnect the internet.
  4. Open that comment's action menu.
  5. Choose Edit.
  6. Change the comment text.
  7. Save the edit. The updated comment should remain visible.
  8. Reconnect the internet. The edited comment should remain correct.

All platforms, attachment previews offline

  1. Open a chat containing an image while online.
  2. Open the image.
  3. Close the image viewer.
  4. Disconnect the internet.
  5. Scroll the image off-screen.
  6. Scroll back to it. Its preview should not be replaced by another attachment.
  7. Reconnect the internet.

QA Steps

Run the All platforms cases and the blocks for the platform being tested, including Offline 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
iOS: mWeb Safari
MacOS: Chrome / Safari

Share the report list imperative contract while retaining a compatibility export for inverted FlashList. Keep row-local preview state tied to its action and let money-report edit scroll requests survive until the list commits its layout.

Co-authored-by: Codex <noreply@openai.com>
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

@chrispader

Copy link
Copy Markdown
Contributor Author

@MelvinBot request review from @roryabraham and @dmkt9 and assign them here.

@MelvinBot

Copy link
Copy Markdown
Contributor

Done. I requested reviews from roryabraham and dmkt9 and assigned them to this PR.


view run

This branch has not been deployed

No deployments
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.

4 participants