Skip to content

[Due for payment 2026-10-01] Use the Table component for the "Add existing expense" flow #100589

Closed

Description

@melvin-bot

Problem

Add expense > Add existing expense (from a report) renders its expense list with SelectionList and applies no sort at all. Auth returns rows newest-first, but the response is merged into the Onyx transactions_ collection and read back out with getEligibleTransactionsToAdd, which does Object.values(transactions).filter(...) — the API ordering is discarded and display order is just Onyx key iteration order. AddExistingExpense.tsx then only filters (search text, status) before mapping to list items, so users see an effectively random ordering and it's hard to bulk-select the expenses they want.

A customer flagged this; the current workaround is to go to Expenses, filter by Unreported + Draft, and bulk-move to a report instead.

Proposal

Convert this view to the Table component (src/components/Table) instead of bolting a one-off sort onto SelectionList. Table already ships sortable column headers (Table.Header), a search/filter bar (Table.FilterBar), empty/no-results/loading states, and multi-select — so we get sorting for free and the list matches how Spend > Expenses behaves.

Default sort should be expense date descending, matching our default expense ordering elsewhere.

Files

  • src/pages/AddExistingExpense.tsx — swap SelectionList for Table, move the status filter into Table.FilterBar, keep the select-all and footer behavior.
  • src/pages/UnreportedExpenseListItem.tsx — becomes the row renderer / column definitions.
  • src/libs/TransactionUtils/index.ts — getEligibleTransactionsToAdd / createUnreportedExpenses.
  • contributingGuides/TABLE.md — component docs; see src/components/Tables/* for existing adoptions.

Things to watch

  • Pagination: the page fetches 50 at a time via fetchUnreportedExpenses and onEndReached. Sorting client-side only sorts what's loaded, so confirm the sort still reads correctly as more pages arrive.
  • Preserve the existing mobile/native layout — check the table renders acceptably on small screens.

Reported in Slack.

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. shawnborton commented on Sep 8, 2026

    @shawnborton
    Contributor

    @Krishna2323 can handle implementation on this one, then we can get a C+ review.

  2. JS00001 commented on Sep 10, 2026

    @JS00001
    Contributor

    Krishna's working on this one

  3. Krishna2323 commented on Sep 11, 2026

    @Krishna2323
    Contributor

    @Expensify/design The PR is ready for initial testing:

    Monosnap.screencast.2026-09-11.16-30-33.1.mp4
  4. dannymcclain commented on Sep 11, 2026

    @dannymcclain
    Contributor

    Video is looking great. Such a better experience than a random unsorted list! 😂

  5. situchan commented on Sep 11, 2026

    @situchan
    Contributor

    I can review this as well

  6. shawnborton commented on Sep 11, 2026

    @shawnborton
    Contributor

    Love it, looks great!

  7. 22 remaining items

  8. situchan commented on Oct 2, 2026

    @situchan
    Contributor

    Contributor+ Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR:
      Link to the comment on the Issue:

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Test:

    1. Open a report/IOU with eligible unreported/draft expenses.
    2. Go to Add expense > Add existing expense and verify expenses load, sorted by date descending.
    3. Click Confirm with nothing selected → verify "Select at least one expense" appears.
    4. Select expenses → click Confirm → verify no error and the flow proceeds.
    5. Select 2-3 expenses, search, then clear the search → verify selections are preserved.
    6. Apply Status filter → verify results filter correctly and selection clears as expected.
    7. Sort by Date and Amount → verify asc/desc toggling works.
    8. Scroll to paginate → verify more expenses load and skeleton appears while loading.
    9. Resize to narrow/RHP width → verify no layout overflow/clipping.
    10. Test offline → verify pending-action feedback renders correctly.
    11. Confirm selected expenses are successfully added to the report.

    Do we agree 👍 or 👎

  9. mallenexpensify commented on Oct 3, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @Krishna2323 due $75 via NewDot
    Contributor+: @situchan due $75 via NewDot

  10. Krishna2323 commented on Oct 5, 2026

    @Krishna2323
    Contributor

    @mallenexpensify @JS00001, could we reduce the payment cut a bit on this one? The only real regression was #102003, and #102021 is really an edge case, so I don't think reducing it to $75 is warranted.

    I think $125 would be fair given the effort involved. $75 feels a bit brutal 😅. These PRs takes time to test, and I often find and fix other issues along the way too. For example, while converting the table, I also noticed the skeletons needed updating and fixed those as well. Getting everything right across different cases takes a fair bit of time and effort.

    Would really appreciate it if we could reconsider the final amount. 🙏

  11. situchan commented on Oct 5, 2026

    @situchan
    Contributor

    Agree and I suggest to consider #102021 as separate issue as the similar production bug happens in other places.

  12. JS00001 commented on Oct 5, 2026

    @JS00001
    Contributor

    I agree with increasing this up to $125, cc @mallenexpensify

  13. reopened this on Oct 5, 2026
  14. mallenexpensify commented on Oct 5, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @Krishna2323 due $125 via NewDot
    Contributor+: @situchan due $125 via NewDot

  15. laurenreidexpensify commented on Oct 21, 2026

    @laurenreidexpensify
    Contributor

    Approved @Krishna2323 $125 New Expensify

  16. laurenreidexpensify commented on Nov 11, 2026

    @laurenreidexpensify
    Contributor

    Approved $125 @situchan New Expensify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2Task

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions