bito-code-review[bot] commented on code in PR #44894:
URL: https://github.com/apache/superset/pull/44894#discussion_r4166243958


##########
superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx:
##########
@@ -380,7 +381,19 @@ const AsyncSelect = forwardRef(
           // merges with existing and creates unique options
           setSelectOptions(prevOptions => {
             mergedData = prevOptions
-              .filter(previousOption => !dataValues.has(previousOption.value))
+              .filter(previousOption => {
+                if (dataValues.has(previousOption.value)) {
+                  return false;
+                }
+                if (
+                  previousOption.isNewOption &&
+                  (hasOption(previousOption.label as V, data, true) ||
+                    hasOption(previousOption.value as V, data, true))
+                ) {
+                  return false;
+                }

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>duplicated new-option filter</b></div>
   <div id="fix">
   
   The new-option-dropping predicate is duplicated: `mergeData` (lines 388-394) 
and the `page === 0` `preservedNew` filter (lines 493-497) both implement 'drop 
isNewOption when `hasOption(label/value, data, true)`'. Extract one helper used 
by both paths to avoid divergence.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #cfc715</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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