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


##########
superset-frontend/src/components/TableSelector/index.tsx:
##########
@@ -335,10 +335,19 @@ const TableSelector: 
FunctionComponent<TableSelectorProps> = ({
       />
     );
 
+    const helpText = data?.hasMore && (
+      <span className="table-length">
+        {t(
+          'Some tables are not shown. Refine your search.',
+        )}

Review Comment:
   **Suggestion:** The warning text instructs users to “Refine your search,” 
but this component only performs client-side filtering on the already-truncated 
`options` list (no server-side search request is triggered), so refining search 
cannot reveal missing tables. Update the message to describe an action that 
actually changes the fetched result set (for example schema/catalog change or 
refresh behavior), otherwise users are guided to a non-working path. [comment 
mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ TableSelector warning suggests ineffective search for missing tables.
   - ⚠️ Datasource editing UX confusing when table list truncated.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Configure a database with more tables than the tables API returns per 
request so that
   `/api/v1/database/<id>/tables/` responds with `json.count > 
json.result.length`, which
   sets `hasMore: true` in the transform (see
   `superset-frontend/src/hooks/apiResources/tables.ts:103-118`, especially 
lines 115-118
   where `hasMore` is computed).
   
   2. Open the physical dataset editor where `TableSelector` is used by 
`DatasourceEditor`
   (see
   
`superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx:20-61`,
   lines 20-61 in the snippet where the `Field` with `fieldKey="tableSelector"` 
renders a
   `TableSelector` control wired to the current database, catalog, and schema).
   
   3. In the rendered `TableSelector` component, observe that it calls 
`useTables` with the
   current `dbId`, `catalog`, and `schema` and receives `data.hasMore = true` 
when the
   response is truncated (see
   `superset-frontend/src/components/TableSelector/index.tsx:185-207` where 
`useTables` is
   invoked, and lines 209-223 where `tableOptions` are derived from 
`data.options`). Because
   `data.hasMore` is truthy, the new `helpText` at lines 338-343 renders the 
message `Some
   tables are not shown. Refine your search.` below the select.
   
   4. Try to follow the instruction by typing into the table select search box. 
The `Select`
   component’s `filterOption` prop is wired to `handleFilterOption` (see 
`index.tsx:304-328`
   for the `Select` and `index.tsx:295-302` for `handleFilterOption`), which 
only filters the
   already-fetched `tableOptions` array client-side and never triggers 
`refetch` or a new
   query. As a result, tables omitted from `data.options` due to truncation can 
never be
   surfaced by refining the search, even though the warning tells the user that 
refining the
   search will help, confirming the suggestion’s mismatch between guidance and 
actual
   behavior.
   ```
   </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=a85d73bbd0df4efa8285af7b4c8e07ac&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=a85d73bbd0df4efa8285af7b4c8e07ac&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/src/components/TableSelector/index.tsx
   **Line:** 340:342
   **Comment:**
        *Comment Mismatch: The warning text instructs users to “Refine your 
search,” but this component only performs client-side filtering on the 
already-truncated `options` list (no server-side search request is triggered), 
so refining search cannot reveal missing tables. Update the message to describe 
an action that actually changes the fetched result set (for example 
schema/catalog change or refresh behavior), otherwise users are guided to a 
non-working path.
   
   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%2F41798&comment_hash=c254c79d60c33eb47898534e8872f133a912255e7a9c894cf92056dcaa210045&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41798&comment_hash=c254c79d60c33eb47898534e8872f133a912255e7a9c894cf92056dcaa210045&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