bito-code-review[bot] commented on code in PR #42483:
URL: https://github.com/apache/superset/pull/42483#discussion_r3751760549
##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx:
##########
@@ -97,6 +97,29 @@ function DndColumnSelect(props: DndColumnSelectProps) {
[optionSelector],
);
+ const onDropFolder = useCallback(
+ (items: DatasourcePanelDndItem[]) => {
+ // Items already passed `canDrop` (in options, not already selected).
+ const columnNames = items
+ .filter(item => item.type === DndItemType.Column)
+ .map(item => (item.value as ColumnMeta).column_name);
+ if (columnNames.length === 0) {
+ return;
+ }
+ if (!optionSelector.multi) {
+ if (!isEmpty(optionSelector.values)) {
+ optionSelector.replace(0, columnNames[0]);
+ } else {
+ optionSelector.add(columnNames[0]);
+ }
+ } else {
+ columnNames.forEach(columnName => optionSelector.add(columnName));
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing duplicate guard in multi add</b></div>
<div id="fix">
`optionSelector.add()` does not deduplicate — if a folder contains the same
column twice, both copies are added in multi mode. Filter with
`optionSelector.has()` before adding, mirroring the singleton branch's guard.
</div>
</div>
<small><i>Code Review Run #aaaf4c</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]