codeant-ai-for-open-source[bot] commented on code in PR #39068:
URL: https://github.com/apache/superset/pull/39068#discussion_r3498132242
##########
superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx:
##########
@@ -675,8 +734,8 @@ const AsyncSelect = forwardRef(
setSelectValue(value);
}
} else {
- const token = tokenSeparators.find(token =>
pastedText.includes(token));
- const array = token ? uniq(pastedText.split(token)) : [pastedText];
+ e.preventDefault();
+ const array = uniq(splitWithQuoteEscaping(pastedText,
tokenSeparators));
Review Comment:
**Suggestion:** Preventing default paste for all multi-select pastes also
breaks async paste-to-search behavior: if the pasted text is not accepted as a
selected value, users cannot paste it into the input to trigger
searching/fetching. This is a functional regression for discoverability of
remote options. Only cancel the event when tokenization/selection handling
fully consumes the pasted input. [logic error]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Async dataset selectors ignore non-tokenizable pasted text.
- ⚠️ Native filter config loses paste-to-search discoverability.
- ❌ Role assignment AsyncSelect cannot search by pasted usernames.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Open a screen using async multi-select, e.g. dataset selector in native
filters config
(`superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx:27`
imports `AsyncSelect` from `@superset-ui/core/components`) with `mode` not
equal to
`'single'` and `allowNewOptions` false.
2. In that AsyncSelect instance, paste a value that does not match any
loaded option and
is not resolvable server-side (e.g. unknown dataset name) into the input.
This triggers
`onPaste` in `AsyncSelect` (`AsyncSelect.tsx:729-748`).
3. In the multi-select branch, `onPaste` calls `e.preventDefault()`
(`AsyncSelect.tsx:737`), then tokenizes via
`splitWithQuoteEscaping(pastedText,
tokenSeparators)` (`AsyncSelect.tsx:738`; `splitWithQuoteEscaping`
implementation in
`utils.tsx:266-297`). For each token, `getPastedTextValue` is awaited
(`AsyncSelect.tsx:739-741`), but when no option is found and
`allowNewOptions` is false,
it returns `undefined` (`AsyncSelect.tsx:703-725`).
4. Because all tokens resolve to `undefined`, the `values` array is empty and
`setSelectValue` does not change state (`AsyncSelect.tsx:742-745`), while
the original
paste is fully suppressed by `preventDefault`. The pasted text never appears
in the input,
and `runSearchLogic` is not called, so users cannot use paste-to-search to
discover remote
async options.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=6abeb2fafb6f4b2a86c301b4af9a5d19&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=6abeb2fafb6f4b2a86c301b4af9a5d19&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/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
**Line:** 737:738
**Comment:**
*Logic Error: Preventing default paste for all multi-select pastes also
breaks async paste-to-search behavior: if the pasted text is not accepted as a
selected value, users cannot paste it into the input to trigger
searching/fetching. This is a functional regression for discoverability of
remote options. Only cancel the event when tokenization/selection handling
fully consumes the pasted input.
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%2F39068&comment_hash=0e0635772c17fe9da5aeff5443001aaa9387209df2c51af31b9ec364e6f1014a&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39068&comment_hash=0e0635772c17fe9da5aeff5443001aaa9387209df2c51af31b9ec364e6f1014a&reaction=dislike'>👎</a>
##########
superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx:
##########
@@ -697,15 +762,8 @@ const Select = forwardRef(
setSelectValue(value);
}
} else {
- const token = tokenSeparators.find(token =>
pastedText.includes(token));
- const array = token
- ? uniq(
- pastedText
- .split(token)
- .map(item => item.trim())
- .filter(Boolean),
- )
- : [pastedText.trim()].filter(Boolean);
+ e.preventDefault();
+ const array = uniq(splitWithQuoteEscaping(pastedText,
tokenSeparators));
Review Comment:
**Suggestion:** Preventing the default paste behavior unconditionally in
multi-select mode blocks normal paste-to-search flows when pasted text does not
resolve to a selected value (for example with `allowNewOptions` disabled). This
causes pasted text to disappear instead of appearing in the input for search.
Only prevent default when you actually consume the paste into
tokens/selections. [logic error]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Static multi-select controls drop non-matching pasted values.
- ⚠️ Explore SelectControl loses paste-to-search capability.
- ⚠️ Native filter dependency selectors ignore unmatched pasted text.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Use a multi-select instance of the static Select component, e.g. column
selector in
native filter config
(`superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx:28`
imports `Select` from `@superset-ui/core/components`) with `mode` not
`'single'`,
`allowNewOptions` and `allowNewOptionsOnPaste` both false.
2. Paste a string that does not correspond to any existing option (e.g. an
invalid column
name) into the Select input while the dropdown is open. This invokes
`onPaste` in `Select`
(`Select.tsx:757-810`).
3. In the multi-select branch, `onPaste` calls `e.preventDefault()`
(`Select.tsx:765`),
then tokenizes the pasted text with `splitWithQuoteEscaping(pastedText,
tokenSeparators)`
(`Select.tsx:766`; implementation in `utils.tsx:266-297`). For each token,
`getOption(item, fullSelectOptions, true)` is used to look up matching
options; when none
exist and `keepUnknownValues` (derived from `allowNewOptions` or
`allowNewOptionsOnPaste`)
is false, the token yields `undefined` and is dropped (`Select.tsx:776-789`).
4. Because no tokens resolve to valid options, `values` remains empty and
`setSelectValue`
does not change state (`Select.tsx:797-807`), while the original clipboard
text is
suppressed by `preventDefault`. The pasted text never appears in the search
input, so
users cannot use paste-to-search to filter static option lists in common
flows like
Explore control `SelectControl`
(`superset-frontend/src/explore/components/controls/SelectControl.tsx:31`)
or dependency
lists in native filter config (`DependencyList.tsx:23`).
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4a01e151e35647d8838ae2e8a272790c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=4a01e151e35647d8838ae2e8a272790c&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/packages/superset-ui-core/src/components/Select/Select.tsx
**Line:** 765:766
**Comment:**
*Logic Error: Preventing the default paste behavior unconditionally in
multi-select mode blocks normal paste-to-search flows when pasted text does not
resolve to a selected value (for example with `allowNewOptions` disabled). This
causes pasted text to disappear instead of appearing in the input for search.
Only prevent default when you actually consume the paste into tokens/selections.
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%2F39068&comment_hash=ec8eb9dd2c1c85417381a4331cba06e1bbea1cc63646596604690c1a16c539d0&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39068&comment_hash=ec8eb9dd2c1c85417381a4331cba06e1bbea1cc63646596604690c1a16c539d0&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]