hadimobarra commented on code in PR #45168:
URL: https://github.com/apache/superset/pull/45168#discussion_r4302569560


##########
superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx:
##########
@@ -570,19 +617,32 @@ const AsyncSelect = forwardRef(
 
           if (allowNewOptions) {
             const unquotedSearch = stripSurroundingQuotes(searchValue);
-            const newOption = unquotedSearch &&
-              !hasOption(unquotedSearch, fullSelectOptions, true) && {
-                label: unquotedSearch,
-                value: unquotedSearch,
-                isNewOption: true,
-              };
-            const cleanSelectOptions = fullSelectOptions.filter(
-              opt => !opt.isNewOption || hasOption(opt.value, selectValue),
-            );
-            const newOptions = newOption
-              ? [newOption, ...cleanSelectOptions]
-              : cleanSelectOptions;
-            setSelectOptions(newOptions);
+            setSelectOptions(prevOptions => {
+              const optionsToCheck = caseSensitiveNewOptionMatching
+                ? fullSelectOptions
+                : [...fullSelectOptions, ...prevOptions];

Review Comment:
   Fixed in c64ed98679. Case-insensitive matching now ignores unselected 
optimistic options from prior searches while retaining selected options and 
server options. Added a regression for changing `my dashboard` to `My 
Dashboard`. `npm test -- 
packages/superset-ui-core/src/components/Select/AsyncSelect.test.tsx` (86 
passed), `npx oxfmt --check ...` and `npx oxlint ...` pass.



-- 
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