Skip to content

fix(table): hide search dropdown when search box is disabled#41772

Open
durgaprasadml wants to merge 2 commits into
apache:masterfrom
durgaprasadml:fix/table-search-dropdown-without-search-box
Open

fix(table): hide search dropdown when search box is disabled#41772
durgaprasadml wants to merge 2 commits into
apache:masterfrom
durgaprasadml:fix/table-search-dropdown-without-search-box

Conversation

@durgaprasadml

Copy link
Copy Markdown
Contributor

Fixes #41747

SUMMARY

This PR fixes an issue where the "Search by" dropdown was displayed in Table charts whenever Server Pagination was enabled, even when the Search Box option was disabled in the Customize tab.

Previously, enabling server-side pagination implicitly caused search-related controls to appear, resulting in confusing behavior for users who intentionally disabled search functionality.

This change updates the rendering logic so that search-related UI elements are only displayed when search functionality is explicitly enabled.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

  • Server Pagination enabled

  • Search Box disabled

  • "Search by" dropdown was still visible

After

  • Server Pagination enabled

  • Search Box disabled

  • "Search by" dropdown is hidden

  • Search controls only appear when Search Box is enabled

TESTING INSTRUCTIONS

  1. Create a Table chart with one or more text columns.

  2. Enable Server Pagination.

  3. Leave Search Box disabled under the Customize tab.

  4. Save and open the chart.

  5. Verify that the "Search by" dropdown is not displayed.

Verify the following scenarios:

Case 1

  • Server Pagination = Disabled

  • Search Box = Disabled

Expected:

  • No search input

  • No search dropdown

Case 2

  • Server Pagination = Disabled

  • Search Box = Enabled

Expected:

  • Search input visible

  • Search dropdown visible

Case 3

  • Server Pagination = Enabled

  • Search Box = Disabled

Expected:

  • No search input

  • No search dropdown

Case 4

  • Server Pagination = Enabled

  • Search Box = Enabled

Expected:

  • Search input visible

  • Search dropdown visible

ADDITIONAL INFORMATION

  • Added regression coverage for search control visibility.

  • Preserves existing server-side pagination functionality.

  • Preserves existing search behavior when Search Box is enabled.

  • No API changes.

  • No database migrations required.

  • Backward compatible with existing saved charts.

@dosubot dosubot Bot added change:frontend Requires changing the frontend viz:charts:table Related to the Table chart labels Jul 4, 2026
@bito-code-review

bito-code-review Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #28cb9a

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx - 1
    • Redundant truthy check · Line 473-475
      The `searchOptions &&` check at line 474 is dead code. Since `searchOptions` is typed as `SearchOption[]` (a required prop that defaults to an empty array in the parent component), it is always truthy — never null or undefined. Only the `searchOptions.length > 0` check at line 475 has functional effect. This redundancy adds noise and could confuse maintainers about the intent.
Review Details
  • Files reviewed - 3 · Commit Range: a9423f7..a9423f7
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx
    • superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx
    • superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +2387 to +2454
describe('Search Select Dropdown conditionally rendering', () => {
it('does not render "Search by" if include_search is false (server pagination enabled)', () => {
const props = transformProps({
...testData.raw,
rawFormData: {
...testData.raw.rawFormData,
server_pagination: true,
include_search: false,
},
});
render(
ProviderWrapper({
children: <TableChart {...props} sticky={false} />,
}),
);
expect(screen.queryByText('Search by:')).not.toBeInTheDocument();
});

it('does not render "Search by" if there are no search options (server pagination enabled)', () => {
const props = transformProps({
...testData.raw,
rawFormData: {
...testData.raw.rawFormData,
server_pagination: true,
include_search: true,
},
queriesData: [
{
...testData.raw.queriesData[0],
colnames: ['num'],
coltypes: [GenericDataType.Numeric],
data: [{ num: 1 }, { num: 2 }],
},
],
});
render(
ProviderWrapper({
children: <TableChart {...props} sticky={false} />,
}),
);
expect(screen.queryByText('Search by:')).not.toBeInTheDocument();
});

it('renders "Search by" if include_search is true and there are search options (server pagination enabled)', () => {
const props = transformProps({
...testData.raw,
rawFormData: {
...testData.raw.rawFormData,
server_pagination: true,
include_search: true,
},
queriesData: [
{
...testData.raw.queriesData[0],
colnames: ['name'],
coltypes: [GenericDataType.String],
data: [{ name: 'Michael' }, { name: 'John' }],
},
],
});
render(
ProviderWrapper({
children: <TableChart {...props} sticky={false} />,
}),
);
expect(screen.queryByText('Search by:')).toBeInTheDocument();
});
});

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.

Suggestion: Replace this newly introduced grouping block with standalone test() cases (or flatten into existing tests) so the added component test logic does not introduce a new describe() wrapper. [custom_rule]

Severity Level: Minor ⚠️

Why it matters? 🤔

The added block is new component test code and it introduces a nested describe() wrapper around only three related test cases. This matches the rule against using describe() when standalone test() cases would suffice.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
**Line:** 2387:2454
**Comment:**
	*Custom Rule: Replace this newly introduced grouping block with standalone `test()` cases (or flatten into existing tests) so the added component test logic does not introduce a new `describe()` wrapper.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

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.

@durgaprasadml preferably, new tests to be inline and not nested. Can you help taking a look?

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.

Yes — this is a valid style nit.

The new describe('Search Select Dropdown conditionally rendering', ...) wrapper isn’t necessary here, and it goes against the “avoid nesting” testing guideline. These three cases can be flattened into standalone test() blocks at the same level as the surrounding tests, while keeping the same assertions and setup.

For example:

test('does not render "Search by" if include_search is false (server pagination enabled)', () => {
  // ...
});

test('does not render "Search by" if there are no search options (server pagination enabled)', () => {
  // ...
});

test('renders "Search by" if include_search is true and there are search options (server pagination enabled)', () => {
  // ...
});

That keeps the tests easy to scan and avoids an extra grouping layer for only three cases.

The behavior being tested is still important, so the coverage should stay — just flattened inline. If you want, I can also help adjust the rest of the PR comments in the same style.

@bito-code-review

Copy link
Copy Markdown
Contributor

The review suggestion is correct. Introducing a describe() block for only three test cases is unnecessary and violates the practice of keeping test suites flat when standalone test() cases suffice. You can resolve this by removing the describe wrapper and promoting the it blocks to top-level tests within the existing describe('plugin-chart-table', ...) block.

There are no other comments on this PR to address.

superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx

it('does not render "Search by" if include_search is false (server pagination enabled)', () => {
    // ... test implementation
  });

  it('does not render "Search by" if there are no search options (server pagination enabled)', () => {
    // ... test implementation
  });

  it('renders "Search by" if include_search is true and there are search options (server pagination enabled)', () => {
    // ... test implementation
  });

Comment on lines +2402 to +2452
expect(screen.queryByText('Search by:')).not.toBeInTheDocument();
});

it('does not render "Search by" if there are no search options (server pagination enabled)', () => {
const props = transformProps({
...testData.raw,
rawFormData: {
...testData.raw.rawFormData,
server_pagination: true,
include_search: true,
},
queriesData: [
{
...testData.raw.queriesData[0],
colnames: ['num'],
coltypes: [GenericDataType.Numeric],
data: [{ num: 1 }, { num: 2 }],
},
],
});
render(
ProviderWrapper({
children: <TableChart {...props} sticky={false} />,
}),
);
expect(screen.queryByText('Search by:')).not.toBeInTheDocument();
});

it('renders "Search by" if include_search is true and there are search options (server pagination enabled)', () => {
const props = transformProps({
...testData.raw,
rawFormData: {
...testData.raw.rawFormData,
server_pagination: true,
include_search: true,
},
queriesData: [
{
...testData.raw.queriesData[0],
colnames: ['name'],
coltypes: [GenericDataType.String],
data: [{ name: 'Michael' }, { name: 'John' }],
},
],
});
render(
ProviderWrapper({
children: <TableChart {...props} sticky={false} />,
}),
);
expect(screen.queryByText('Search by:')).toBeInTheDocument();

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.

Suggestion: The new assertions look for Search by: (with a colon), but this table component renders Search by (without a colon). That makes the positive test fail and allows the negative tests to pass even when the dropdown is actually present. Update the queried text to match the rendered label so the regression tests validate the real behavior. [logic error]

Severity Level: Major ⚠️
- ❌ Search dropdown visibility test fails despite correct behavior.
- ⚠️ Regression tests misvalidate label text and visibility.
- ⚠️ Future UI regressions may pass unnoticed by these tests.
Steps of Reproduction ✅
1. Open `superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx` and
locate the search dropdown rendering block at lines 585-591, where the label is rendered
as `t('Search by')` without any colon.

2. Open `superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx` and
inspect the "Search Select Dropdown conditionally rendering" tests at lines 2388-2452,
which all use `screen.queryByText('Search by:')` (with a colon) in their assertions.

3. Run the frontend Jest tests (e.g. `TableChart.test.tsx` via the project's test runner);
the positive test `"renders "Search by" if include_search is true and there are search
options (server pagination enabled)"` at lines 2430-2453 will fail because no element with
exact text `Search by:` exists, even though the dropdown label `Search by` is correctly
rendered.

4. Note that the two negative tests at lines 2388-2428 will still pass even if a dropdown
with label `Search by` is accidentally rendered, because they query `Search by:`
specifically; this mismatch between rendered text and asserted text means the regression
tests do not accurately validate the real UI behavior.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
**Line:** 2402:2452
**Comment:**
	*Logic Error: The new assertions look for `Search by:` (with a colon), but this table component renders `Search by` (without a colon). That makes the positive test fail and allows the negative tests to pass even when the dropdown is actually present. Update the queried text to match the rendered label so the regression tests validate the real behavior.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@durgaprasadml durgaprasadml force-pushed the fix/table-search-dropdown-without-search-box branch from a9423f7 to 9f1802a Compare July 4, 2026 18:45
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 4, 2026
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.68%. Comparing base (a9aabda) to head (e664052).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41772      +/-   ##
==========================================
+ Coverage   64.66%   64.68%   +0.01%     
==========================================
  Files        2685     2685              
  Lines      148534   148538       +4     
  Branches    34269    34273       +4     
==========================================
+ Hits        96055    96087      +32     
+ Misses      50720    50692      -28     
  Partials     1759     1759              
Flag Coverage Δ
javascript 69.53% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bito-code-review

bito-code-review Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c4babc

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx - 1
    • Test coverage gap · Line 585-596
      The conditional fix correctly guards against rendering when `searchOptions` is falsy or empty. However, existing tests only use `searchOptions={[]}` and don't test the scenario with real search options + serverPagination enabled. A test covering the non-empty searchOptions case would validate the fix and prevent regression.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx - 1
Review Details
  • Files reviewed - 3 · Commit Range: 9f1802a..9f1802a
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx
    • superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx
    • superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas

rusackas commented Jul 5, 2026

Copy link
Copy Markdown
Member

@durgaprasadml looks like #36073 (and #35204 before it) already landed the search-box gating on master, so I think what's left here is the empty searchOptions guard and the regression tests, which are still worth having IMO, but can you double-check the issue still repros on master?

@rusackas

rusackas commented Jul 5, 2026

Copy link
Copy Markdown
Member

Also, mind flattening the new describe() block into plain test()s (we're trying to avoid nesting those), and giving the bot comments above a look? The colon one seems wrong to me since CI's green on the PR, but worth a reply. Thanks!

@durgaprasadml durgaprasadml force-pushed the fix/table-search-dropdown-without-search-box branch from 9f1802a to 8868e1a Compare July 5, 2026 07:32
@netlify

netlify Bot commented Jul 5, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 8868e1a
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a4a0875feef1100087f8cf8
😎 Deploy Preview https://deploy-preview-41772--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

bito-code-review Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #652cb8

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx - 1
    • Logic change needs test coverage · Line 585-596
      The new condition combining `serverPagination && searchOptions && searchOptions.length > 0` introduces a behavioral change: when `searchOptions` is an empty array, the dropdown no longer renders. This aligns with UX best practice (avoiding disabled empty dropdowns), but the change should be explicitly tested with an empty array case to verify intended behavior matches expectations.
Review Details
  • Files reviewed - 4 · Commit Range: 8868e1a..8868e1a
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx
    • superset-frontend/plugins/plugin-chart-ag-grid-table/test/AgGridTableChart.test.tsx
    • superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx
    • superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@durgaprasadml durgaprasadml force-pushed the fix/table-search-dropdown-without-search-box branch from 784a929 to e664052 Compare July 5, 2026 19:13
@bito-code-review

bito-code-review Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #a90223

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 8868e1a..e664052
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/useColDefs.ts
    • superset-frontend/plugins/plugin-chart-ag-grid-table/test/AgGridTableChart.test.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas self-requested a review July 6, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend plugins size/L viz:charts:table Related to the Table chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search by option is shown even when there is no search term in tables

3 participants