Skip to content

Gate DomainGroupsTable search bar behind a 15-item minimum#96157

Closed
MelvinBot wants to merge 1 commit into
mainfrom
claude-domainGroupsSearchBarThreshold
Closed

Gate DomainGroupsTable search bar behind a 15-item minimum#96157
MelvinBot wants to merge 1 commit into
mainfrom
claude-domainGroupsSearchBarThreshold

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

The Domain → Groups table search bar was showing even when there were only a couple of groups, regressing the previous behavior where the search field only appeared once a domain had a meaningful number of groups.

This restores a minimum-item gate as an opt-in, per-table prop so no other list is silently affected:

  • Added an optional minItemsForSearchBar prop to the shared Table.FilterBar (src/components/Table/TableFilterBar/index.tsx), defaulting to 0, so the search bar keeps showing everywhere else exactly as before.
  • The TableSearchBar now only renders when originalDataLength >= minItemsForSearchBar.
  • When the search bar is hidden and there are no filters, chips, or action-column children to show, the entire filter bar returns null so it doesn't leave an empty padded gap (this is a no-op for every table using the default threshold of 0, where the search bar always renders).
  • DomainGroupsTable passes minItemsForSearchBar={CONST.DOMAIN_GROUPS_SEARCH_BAR_THRESHOLD} (15), so the search field only appears once a domain has at least 15 groups.

Fixed Issues

$ #95555
PROPOSAL: #95555

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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 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 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)
  • 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.
  • 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

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team July 15, 2026 03:26
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-domainGroupsSearchBarThreshold
git checkout -b claude-domainGroupsSearchBarThreshold upstream/claude-domainGroupsSearchBarThreshold
git push -u origin claude-domainGroupsSearchBarThreshold

Then you can close this PR and open a new one from your fork.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (ø)
src/components/Table/TableFilterBar/index.tsx 100.00% <100.00%> (ø)
src/components/Tables/DomainGroupsTable/index.tsx 0.00% <0.00%> (ø)
... and 8 files with indirect coverage changes

@truph01

truph01 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot mark this pr as ready

@MelvinBot MelvinBot marked this pull request as ready for review July 15, 2026 03:34
@MelvinBot MelvinBot requested a review from a team as a code owner July 15, 2026 03:34
@melvin-bot melvin-bot Bot requested a review from truph01 July 15, 2026 03:34
@melvin-bot

melvin-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

@truph01 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 trjExpensify and removed request for a team July 15, 2026 03:34
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Done — this PR is now marked as Ready for review.

/** Label and accessibility label for the search input. */
label: string;

/** The minimum number of items (before searching/filtering) required to render the search bar. Defaults to 0 so the search bar always shows. */

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.

❌ CLEAN-REACT-PATTERNS-1 (docs)

The new minItemsForSearchBar prop is configuration that gates whether an internal UI element renders: its sole effect is the conditional {shouldShowSearchBar && <TableSearchBar label={label} />} block below. Table is already a compound/composition component (Table.FilterBar, Table.Header, Table.Body, Table.NoResultsState), so search-bar presence should be expressed compositionally (the consumer includes or omits the search bar) rather than by threading a numeric threshold prop that branches inside the component. Each new threshold/flag prop enlarges the component's API and couples every consumer to its internals.

Suggested fix: expose the search bar as a composable child (e.g. Table.SearchBar) that the consumer renders or not, and let DomainGroupsTable decide whether to include it based on the item count, instead of adding minItemsForSearchBar to TableFilterBar:

// DomainGroupsTable
<Table.FilterBar label={translate('domain.groups.findGroup')}>
    {groups.length >= CONST.DOMAIN_GROUPS_SEARCH_BAR_THRESHOLD && <Table.SearchBar label={translate('domain.groups.findGroup')} />}
</Table.FilterBar>

Reviewed at: daab196 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I looked into the failing checks. There's no code failure to fix — every real CI check is green.

The only red check is PR Author Checklist / checklist, and it's failing for a non-code reason:

PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item.

That check just verifies the author checklist boxes are ticked and the PR body is filled out. Right now:

  • The Tests and QA Steps sections still have the placeholder // TODO: These must be filled out...
  • The PR Author Checklist boxes are unticked

These are things only you (the author) should complete — I won't fill out test/QA steps or tick author-checklist boxes on your behalf. Once you fill in the Tests/QA sections and check the boxes, this check will pass.

For reference, everything else is passing: ESLint, typecheck, all 8 test jobs, Oxfmt, Bun tests, Storybook, React Compiler compliance, unused-styles/knip, spellcheck, and both dev builds. I also ran npm run typecheck locally against your changes and it passed with no errors. (review is still "pending" only because it waits on a human reviewer, not a code issue.)

So nothing to push here — the ball is in your court to complete the checklist.

@trjExpensify trjExpensify left a comment

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 15? Isn't the magic number 12? (CC: @Expensify/design this one again 😆)

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Re-checked — still no code failure to push. The two red checks are both human checklist checks, not CI/code failures:

  • PR Author Checklist / checklist — fails because the author checklist boxes aren't ticked and the Tests/QA Steps sections still have the // TODO placeholder.
  • PR Reviewer Checklist / checklist — fails because the reviewer checklist boxes aren't ticked yet.

Both are completed by people (you as author, and the reviewer), and I won't fill out test/QA steps or tick checklist boxes on anyone's behalf. Once those boxes are checked and the Tests/QA sections filled in, they'll go green.

Every actual CI check is passing: ESLint, typecheck, all 8 test jobs, Oxfmt, Bun tests, Storybook, React Compiler compliance, knip/unused-styles, spellcheck, and both dev builds. Nothing for me to fix here.

@shawnborton

Copy link
Copy Markdown
Contributor

Haha I do think we settled on 12 at some point?

@shawnborton

Copy link
Copy Markdown
Contributor

BUT with our new table style, we wanted to always show show the search input above the table no matter what. cc @JS00001 for confirmation

@trjExpensify

Copy link
Copy Markdown
Contributor

Ohhh, in which case, this would not be a bug? 😅

@shawnborton

Copy link
Copy Markdown
Contributor

Correct! I say we close it all up 🪡

@trjExpensify

Copy link
Copy Markdown
Contributor

Donezo

@JS00001

JS00001 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Agreed, thanks

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