Skip to content

Move Total column after Comment Indicator in expense report view#89757

Closed
MelvinBot wants to merge 6 commits intomainfrom
claude-moveTotalColumnAfterComments
Closed

Move Total column after Comment Indicator in expense report view#89757
MelvinBot wants to merge 6 commits intomainfrom
claude-moveTotalColumnAfterComments

Conversation

@MelvinBot
Copy link
Copy Markdown
Contributor

@MelvinBot MelvinBot commented May 6, 2026

Explanation of Change

Move the Total column so it appears after the Comment Indicator in the expense report table view. This swaps the default column order (COMMENTS now comes before TOTAL) and ensures the custom columns flow also appends TOTAL after COMMENTS when a user hasn't explicitly placed it.

Fixed Issues

$ #88967

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.

  • Verify that no errors appear in the JS console

Offline tests

N/A — column ordering is static and does not depend on network state.

QA Steps

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".

  • 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 followed proper code patterns (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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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 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 a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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

Swap the default column order so COMMENTS appears before TOTAL in the
expense report table. Also ensure TOTAL is appended after COMMENTS in
the custom columns flow when not explicitly placed by the user.

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
@cretadn22
Copy link
Copy Markdown
Contributor

@MelvinBot Please apply this git diff to update the icon width

diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts
index 1e493e89c77..52be519b854 100644
--- a/src/styles/utils/index.ts
+++ b/src/styles/utils/index.ts
@@ -1861,7 +1861,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
         let columnWidth;
         switch (columnName) {
             case CONST.SEARCH.TABLE_COLUMNS.COMMENTS:
-                columnWidth = {...getWidthStyle(variables.w36), ...styles.alignItemsCenter};
+                columnWidth = {...getWidthStyle(variables.w20), ...styles.alignItemsCenter};
                 break;
             case CONST.SEARCH.TABLE_COLUMNS.RECEIPT:
                 columnWidth = {...getWidthStyle(variables.w28), ...styles.alignItemsCenter};

@cretadn22
Copy link
Copy Markdown
Contributor

@MelvinBot Please update the checklist and open the PR

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Applied the diff — updated COMMENTS column width from variables.w36 to variables.w20 in src/styles/utils/index.ts:1864.

@MelvinBot MelvinBot marked this pull request as ready for review May 6, 2026 14:32
@MelvinBot MelvinBot requested review from a team as code owners May 6, 2026 14:32
@melvin-bot melvin-bot Bot requested a review from cretadn22 May 6, 2026 14:32
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated the PR Author Checklist (checked all applicable items for this change) and marked the PR as ready for review. Note: the Tests and QA Steps sections still need to be filled out by the human co-author.

@melvin-bot melvin-bot Bot requested review from trjExpensify and removed request for a team and trjExpensify May 6, 2026 14:32
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 6, 2026

@cretadn22 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 removed the request for review from a team May 6, 2026 14:32
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70f5991d5a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/styles/utils/index.ts
switch (columnName) {
case CONST.SEARCH.TABLE_COLUMNS.COMMENTS:
columnWidth = {...getWidthStyle(variables.w36), ...styles.alignItemsCenter};
columnWidth = {...getWidthStyle(variables.w20), ...styles.alignItemsCenter};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep comment column min-width in sync with rendered width

Reducing the COMMENTS column width to w20 here without updating getTableMinWidth() leaves the layout math inconsistent (src/libs/SearchUIUtils.ts still adds 36px for COMMENTS). In views that gate horizontal scrolling on minTableWidth (e.g., money request report/search tables), this can incorrectly enable horizontal scroll on borderline viewport sizes because the table is overestimated by 16px whenever the comments indicator is shown.

Useful? React with 👍 / 👎.

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.

@MelvinBot Please check this comment

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 review comment is valid. getTableMinWidth() at src/libs/SearchUIUtils.ts:5574 still adds 36px for COMMENTS, but the rendered width is now w20 (20px). This mismatch causes the min-width calculation to overestimate by 16px, which could incorrectly enable horizontal scrolling on borderline viewport sizes.

Should I update line 5574 to minWidth += 20 to match?

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.

@cretadn22
Copy link
Copy Markdown
Contributor

@MelvinBot Please complete the checklist

Comment thread src/libs/SearchUIUtils.ts Outdated
Comment on lines +5267 to +5269
if (!addedColumns.has(CONST.SEARCH.TABLE_COLUMNS.TOTAL)) {
result.push(CONST.SEARCH.TABLE_COLUMNS.TOTAL);
}
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.

@MelvinBot We should not add this.

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.

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.

@MelvinBot This might be outside the scope of the current task

@MelvinBot
Copy link
Copy Markdown
Contributor Author

The failing checks are not related to code changes in this PR:

  • checklist: PR Author Checklist — not a code issue
  • review: The automated Claude Code review step was cancelled due to a timeout after ~6 minutes — this is a CI infrastructure issue, not a code problem

All code-related checks (tests, ESLint, typecheck, Prettier, builds, perf-tests, Storybook) are passing. No fix needed.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue — try again. If it persists, check status.anthropic.com.

Run details

@MelvinBot
Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue — try again. If it persists, check status.anthropic.com.

Run details

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here.

@shawnborton
Copy link
Copy Markdown
Contributor

Hmm I still see it after the total:
CleanShot 2026-05-06 at 22 15 02@2x

@MelvinBot
Copy link
Copy Markdown
Contributor Author

The only non-checklist failure is the review check, which was cancelled mid-run (The operation was canceled) — not a code failure. All code checks pass (ESLint, TypeScript, all 8 test shards, builds, prettier, spellcheck, etc.).

Re-running the review check should resolve this. No code fix is needed.

…path

When TOTAL is already in filteredVisibleColumns, COMMENTS was being
appended after it. Use splice to insert COMMENTS before TOTAL instead.

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner May 7, 2026 11:30
@melvin-bot melvin-bot Bot requested a review from cretadn22 May 7, 2026 11:31
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Fixed — the COMMENTS column was being appended after TOTAL because result.push() placed it at the end of the array when TOTAL was already present from filteredVisibleColumns. Changed it to splice COMMENTS in front of TOTAL when TOTAL already exists in the result.

@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 7, 2026

@cretadn22 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 removed the request for review from a team May 7, 2026 11:31
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

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

Files with missing lines Coverage Δ
src/libs/SearchUIUtils.ts 63.93% <100.00%> (+0.17%) ⬆️
src/styles/utils/index.ts 48.16% <ø> (+0.13%) ⬆️
... and 186 files with indirect coverage changes

@shawnborton
Copy link
Copy Markdown
Contributor

Let me know when this is ready for new builds

Comment thread src/libs/SearchUIUtils.ts Outdated
Comment on lines +5264 to +5272
const totalIndex = result.indexOf(CONST.SEARCH.TABLE_COLUMNS.TOTAL);
if (totalIndex >= 0) {
result.splice(totalIndex, 0, CONST.SEARCH.TABLE_COLUMNS.COMMENTS);
} else {
result.push(CONST.SEARCH.TABLE_COLUMNS.COMMENTS);
}
}

if (!addedColumns.has(CONST.SEARCH.TABLE_COLUMNS.TOTAL)) {
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.

@MelvinBot Could you revert this change?

Reverts the splice insertion of COMMENTS before TOTAL, restoring the
original push behavior.

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Reverted the COMMENTS-before-TOTAL splice logic — restored the original result.push behavior.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

The failing test (job 4) check is unrelated to this PR — it's a flaky infrastructure crash, not a code issue.

Failure: tests/ui/PaginationTest.tsx was killed by SIGSEGV (segfault in a Jest worker process). All 2110 actual test assertions passed; the suite failed only because the worker crashed.

Evidence: This PR changes src/libs/SearchUIUtils.ts, src/styles/utils/index.ts, and tests/unit/Search/SearchUIUtilsTest.ts — none of which are related to PaginationTest.tsx.

The other failing check (checklist) is the PR Author Checklist, which requires manual action.

Recommendation: Re-run the failed job to clear the flaky test.

Comment thread src/libs/SearchUIUtils.ts Outdated
Comment on lines +5267 to +5268
if (!addedColumns.has(CONST.SEARCH.TABLE_COLUMNS.TOTAL)) {
result.push(CONST.SEARCH.TABLE_COLUMNS.TOTAL);
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.

@MelvinBot Don't need to push TOTAL column in all cases

@MelvinBot
Copy link
Copy Markdown
Contributor Author

The failing test (job 4) check is unrelated to this PR — it's a CI infrastructure issue.

Failure: tests/ui/PaginationTest.tsx crashed with SIGSEGV (segfault in the jest worker process), not an actual test assertion failure. All 2110 tests that ran passed.

Evidence: This PR only touches src/libs/SearchUIUtils.ts, src/styles/utils/index.ts, and tests/unit/Search/SearchUIUtilsTest.ts — none of which are related to PaginationTest.tsx.

The other failing checks (checklist) are the PR Author/Reviewer checklists which require manual action.

Recommendation: Re-run the failed Jest Unit Tests workflow to clear the flaky failure.

COMMENTS is now spliced before TOTAL when TOTAL already exists in the
result array. The unconditional TOTAL push is removed since TOTAL
comes from filteredVisibleColumns.

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Done — removed the unconditional TOTAL push and kept the splice logic to insert COMMENTS before TOTAL when it's already in the result array.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@cretadn22
Copy link
Copy Markdown
Contributor

@MelvinBot Could you revert all your changes and apply this diff?

diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts
index f3b95f2661e..fc9c3cbfa61 100644
--- a/src/libs/SearchUIUtils.ts
+++ b/src/libs/SearchUIUtils.ts
@@ -5197,8 +5197,8 @@ function getColumnsToShow({
               [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE]: shouldShowReimbursableColumn,
               [CONST.SEARCH.TABLE_COLUMNS.BILLABLE]: shouldShowBillableColumn,
               [CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT]: false,
-              [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true,
               [CONST.SEARCH.TABLE_COLUMNS.COMMENTS]: shouldShowCommentsColumn,
+              [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true,
           }
         : {
               [CONST.SEARCH.TABLE_COLUMNS.AVATAR]: true,
diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts
index 560a397679e..cba4737f602 100644
--- a/src/styles/utils/index.ts
+++ b/src/styles/utils/index.ts
@@ -1889,7 +1889,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
         let columnWidth;
         switch (columnName) {
             case CONST.SEARCH.TABLE_COLUMNS.COMMENTS:
-                columnWidth = {...getWidthStyle(variables.w36), ...styles.alignItemsCenter};
+                columnWidth = {...getWidthStyle(variables.w20), ...styles.alignItemsCenter};
                 break;
             case CONST.SEARCH.TABLE_COLUMNS.RECEIPT:
                 columnWidth = {...getWidthStyle(variables.w28), ...styles.alignItemsCenter};

Swap COMMENTS before TOTAL in default column map and reduce
COMMENTS column width from w36 to w20.

Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Reverted all previous changes and applied the requested diff. The PR now only contains the two targeted changes:

  1. Swapped COMMENTS before TOTAL in the default column map (SearchUIUtils.ts:5200-5201)
  2. Reduced COMMENTS column width from w36 to w20 (styles/utils/index.ts:1892)

@cretadn22
Copy link
Copy Markdown
Contributor

@MelvinBot Please close this PR

@MelvinBot MelvinBot closed this May 7, 2026
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Closed as requested.

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.

3 participants