codeant-ai-for-open-source[bot] commented on code in PR #36073:
URL: https://github.com/apache/superset/pull/36073#discussion_r3454539268


##########
superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx:
##########
@@ -576,30 +581,32 @@ export default typedMemo(function DataTable<D extends 
object>({
               />
             ) : null}
             <Flex wrap align="center" gap="middle">
-              {serverPagination && searchInput && (
-                <Space size="small" className="search-select-container">
-                  <span className="search-by-label">{t('Search by')}:</span>
-                  <SearchSelectDropdown
-                    searchOptions={searchOptions}
-                    value={serverPaginationData?.searchColumn || ''}
-                    onChange={onSearchColChange}
-                  />
-                </Space>
-              )}
               {searchInput && (
-                <GlobalFilter<D>
-                  searchInput={
-                    typeof searchInput === 'boolean' ? undefined : searchInput
-                  }
-                  preGlobalFilteredRows={preGlobalFilteredRows}
-                  setGlobalFilter={
-                    manualSearch ? handleSearchChange : setGlobalFilter
-                  }
-                  filterValue={manualSearch ? initialSearchText : filterValue}
-                  id={searchInputId}
-                  serverPagination={!!serverPagination}
-                  rowCount={rowCount}
-                />
+                <>
+                  {serverPagination && (
+                    <Space direction="vertical" size={4}>
+                      {t('Search by')}
+                      <SearchSelectDropdown
+                        searchOptions={searchOptions}
+                        value={serverPaginationData?.searchColumn || ''}

Review Comment:
   **Suggestion:** Passing `''` when no selected column exists prevents the 
dropdown's fallback-to-first-option logic from running (`''` is not nullish). 
That leaves the UI with an empty selection while search requests still default 
to the first option elsewhere, creating a UI/state mismatch. Pass `undefined` 
when there is no selected column so the dropdown can correctly default. [logic 
error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Search dropdown appears blank despite active search column.
   - ⚠️ Users search one column while UI suggests none.
   - ⚠️ Confusing server-side search behavior for table charts.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. In `superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx`, a 
`DataTable` is
   rendered at lines 1607-1618, passing `serverPagination={serverPagination}`,
   `manualSearch={serverPagination}`, `searchOptions={searchOptions}`, and
   `onSearchColChange={handleChangeSearchCol}`; `handleSearch` constructs 
`searchColumn` as
   `serverPaginationData?.searchColumn || searchOptions[0]?.value` at
   `TableChart.tsx:1538-1543`.
   
   2. On initial load with server-side pagination enabled and search box 
included,
   `serverPaginationData?.searchColumn` is unset (there is no initialization 
elsewhere; it is
   only set in `handleChangeSearchCol` at `TableChart.tsx:1551-1556`), so it is 
`undefined`
   when passed into `DataTable`.
   
   3. In `DataTable.tsx`, the search controls render at lines 586-596: the
   `SearchSelectDropdown` is given `value={serverPaginationData?.searchColumn 
|| ''}` (line
   591 from the diff), which evaluates to the empty string `''` when 
`searchColumn` is
   `undefined`.
   
   4. The `SearchSelectDropdown` component
   
(`superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SearchSelectDropdown.tsx:33-45`)
   sets its internal select value via `value={value ?? 
searchOptions?.[0]?.value}`; because
   `value` is `''` (not null or undefined), the nullish coalescing operator 
does not fall
   back to `searchOptions[0].value`, leaving the underlying `RawAntdSelect` 
with a `value` of
   `''` that does not match any `options` entry.
   
   5. When the user types into the search box, `GlobalFilter` in 
`DataTable.tsx` (lines
   596-205) calls `handleSearchChange`, which forwards to `handleSearch` in
   `TableChart.tsx:1538-1545`; there, `searchColumn` is computed as
   `serverPaginationData?.searchColumn || searchOptions[0]?.value`, so the 
backend search
   runs against `searchOptions[0].value` while the dropdown still shows no 
visible selection
   because it is bound to `''`, creating a UI/state mismatch.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=2fec1c904e5649e49bc99e4fe01b87e8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=2fec1c904e5649e49bc99e4fe01b87e8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx
   **Line:** 591:591
   **Comment:**
        *Logic Error: Passing `''` when no selected column exists prevents the 
dropdown's fallback-to-first-option logic from running (`''` is not nullish). 
That leaves the UI with an empty selection while search requests still default 
to the first option elsewhere, creating a UI/state mismatch. Pass `undefined` 
when there is no selected column so the dropdown can correctly default.
   
   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
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36073&comment_hash=fac8b5a28b65ed0f941dc21700b315084f246473a82b0631dd6c6fd48ef7fd47&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36073&comment_hash=fac8b5a28b65ed0f941dc21700b315084f246473a82b0631dd6c6fd48ef7fd47&reaction=dislike'>👎</a>



##########
superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SearchSelectDropdown.tsx:
##########
@@ -17,15 +17,10 @@
  * under the License.
  */
 /* eslint-disable import/no-extraneous-dependencies */
-import { styled } from '@apache-superset/core/theme';
-import { RawAntdSelect } from '@superset-ui/core/components';
+import { css, SupersetTheme } from '@apache-superset/core/ui';

Review Comment:
   **Suggestion:** This file also imports from `@apache-superset/core/ui`, 
which is not an exported subpath of `@apache-superset/core`; this will fail 
resolution and prevent the component from loading. Use the standard exported 
theme module for `css`/theme types. [import error]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ SearchSelectDropdown component fails to resolve at build.
   - ❌ Table chart search controls unavailable in the UI.
   - ⚠️ Frontend build stability impacted by bad import path.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open
   
`superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SearchSelectDropdown.tsx`,
   where line 20 imports `{ css, SupersetTheme }` from 
`@apache-superset/core/ui` and the
   component is defined at lines 33-45 using these theme utilities.
   
   2. Note that `SearchSelectDropdown` is used by `DataTable` at
   
`superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx:586-592`,
 so any
   Table chart render will require this module to be resolved and bundled.
   
   3. Run the Superset frontend build or dev server so the bundler compiles the 
table chart
   plugin, including `SearchSelectDropdown.tsx`.
   
   4. During module resolution, the bundler attempts to load 
`@apache-superset/core/ui` from
   `SearchSelectDropdown.tsx:20`; however, a repository-wide `Grep` shows no 
other imports of
   this subpath and confirms the established pattern is 
`@apache-superset/core/theme` instead
   (e.g.,
   
`superset-frontend/plugins/plugin-chart-word-cloud/src/plugin/controls/ColorSchemeControl/ColorSchemeLabel.tsx:20`
   and `superset-frontend/src/dashboard/styles.ts:19`), so resolution fails and 
the build
   throws "Module not found: Can't resolve '@apache-superset/core/ui'", 
preventing the
   SearchSelectDropdown (and thus the Table chart) from loading.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=672ac3be50714543a1b76abbf4c7aa07&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=672ac3be50714543a1b76abbf4c7aa07&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SearchSelectDropdown.tsx
   **Line:** 20:20
   **Comment:**
        *Import Error: This file also imports from `@apache-superset/core/ui`, 
which is not an exported subpath of `@apache-superset/core`; this will fail 
resolution and prevent the component from loading. Use the standard exported 
theme module for `css`/theme types.
   
   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
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36073&comment_hash=bc4fec3aa6807ff31408ab8bc73745f463c4e96d22ae806e2e91a2a6fe1c9239&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36073&comment_hash=bc4fec3aa6807ff31408ab8bc73745f463c4e96d22ae806e2e91a2a6fe1c9239&reaction=dislike'>👎</a>



##########
superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx:
##########
@@ -16,6 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import { SupersetTheme } from '@apache-superset/core';
+import { css } from '@apache-superset/core/ui';

Review Comment:
   **Suggestion:** The new `css` import uses `@apache-superset/core/ui`, but 
`@apache-superset/core` does not export a `./ui` subpath. This breaks module 
resolution for this file at build/runtime. Import `css` from the supported 
theme entrypoint instead (the same one used elsewhere in this plugin). [import 
error]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ TableChart component fails to compile in frontend build.
   - ❌ Table visualization plugin unusable in Superset UI.
   - ⚠️ Frontend build pipeline breaks on DataTable import.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open 
`superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx`, 
where
   line 19 imports `SupersetTheme` from `@apache-superset/core` and line 20 
imports `css`
   from `@apache-superset/core/ui`.
   
   2. Build or start the Superset frontend so the `superset-frontend` bundle 
compiles the
   Table chart plugin, including `DataTable.tsx` (TableChart uses this 
component at
   `superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:1607-1618`).
   
   3. During compilation, the module resolver attempts to resolve 
`@apache-superset/core/ui`
   from `DataTable.tsx:20`.
   
   4. The `Grep` search shows that all other theme-related imports in this repo 
use
   `@apache-superset/core/theme` (e.g., 
`superset-frontend/src/dashboard/styles.ts:19`), and
   there are no other references to `@apache-superset/core/ui`, so the resolver 
cannot find
   this subpath and the build fails with a "Module not found: Can't resolve
   '@apache-superset/core/ui'" error, preventing the Table chart bundle from 
loading.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=05578936e458423c9aaab13e91d252b2&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=05578936e458423c9aaab13e91d252b2&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx
   **Line:** 20:20
   **Comment:**
        *Import Error: The new `css` import uses `@apache-superset/core/ui`, 
but `@apache-superset/core` does not export a `./ui` subpath. This breaks 
module resolution for this file at build/runtime. Import `css` from the 
supported theme entrypoint instead (the same one used elsewhere in this plugin).
   
   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
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36073&comment_hash=a6464e9444c89cdba7c2ef6e5f5a0b7ebbb408769dd926b2b3aac5b6eef6c061&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36073&comment_hash=a6464e9444c89cdba7c2ef6e5f5a0b7ebbb408769dd926b2b3aac5b6eef6c061&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to