bito-code-review[bot] commented on PR #41199:
URL: https://github.com/apache/superset/pull/41199#issuecomment-4769288036
<!-- Bito Reply -->
The flagged issue is correct. The current implementation uses the quoted
identifier as the `value` property for autocomplete, which is then passed
directly to `addTable` upon selection. This causes the application to store the
quoted string as the canonical table name, leading to failures in downstream
API calls that expect the raw table name.
To resolve this, you should separate the value used for editor insertion
(which requires quoting) from the value used for state/API identification
(which should be the raw name). You can update the `completer` object in
`useKeywords.ts` to handle the insertion logic separately, ensuring `addTable`
receives the raw `value` while the editor still receives the quoted string for
correct SQL syntax.
Would you like me to fetch all other comments on this PR to validate and
implement fixes for them as well?
**superset-frontend/src/SqlLab/components/EditorWrapper/useKeywords.ts**
```
name: label,
value: value, // Use raw value for state/API
schema: tableSchema,
score: TABLE_AUTOCOMPLETE_SCORE,
meta: 'table',
completer: {
insertMatch: (editor: any, data: any) => {
editor.insert(quoteIdentifier(value)); // Insert quoted value
into editor
addTable(..., value, ...); // Use raw value for state
}
}
```
--
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]