rusackas commented on code in PR #41136:
URL: https://github.com/apache/superset/pull/41136#discussion_r3477098058
##########
superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx:
##########
@@ -693,17 +696,24 @@ const Select = forwardRef(
const array = token ? uniq(pastedText.split(token)) : [pastedText];
const newOptions: SelectOptionsType = [];
+ // When `allowNewOptionsOnPaste` is set, accept pasted values that are
+ // not in the loaded options even if `allowNewOptions` is false. The
+ // full option set is searched server-side and only partially loaded
+ // client-side, so a pasted value can legitimately exist in the dataset
+ // but fall outside the loaded page.
+ const keepUnknownValues = allowNewOptions || allowNewOptionsOnPaste;
const values = array
.map(item => {
const option = getOption(item, fullSelectOptions, true);
- if (!option && allowNewOptions) {
+ if (!option && keepUnknownValues) {
const newOption = {
label: item,
value: item,
isNewOption: true,
};
newOptions.push(newOption);
+ return labelInValue ? { label: item, value: item } : item;
Review Comment:
Good catch — now trimming each token (and dropping empties) before
lookup/creation, so `"Liam, OutsideValue"` stores `OutsideValue`. Added a test
for it.
--
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]