mirror of
https://github.com/apache/superset.git
synced 2026-04-24 02:25:13 +00:00
fix(explore): dnd error when dragging metric if multi: false (#16088)
* fix(explore): dnd error when dragging metric if multi: false * Fix error for non-dnd controls
This commit is contained in:
committed by
GitHub
parent
578a9e9d53
commit
b7cc89c6d4
@@ -245,7 +245,10 @@ export const DndMetricSelect = (props: any) => {
|
||||
[props.savedMetrics, props.value],
|
||||
);
|
||||
|
||||
const handleDropLabel = useCallback(() => onChange(value), [onChange, value]);
|
||||
const handleDropLabel = useCallback(
|
||||
() => onChange(multi ? value : value[0]),
|
||||
[multi, onChange, value],
|
||||
);
|
||||
|
||||
const valueRenderer = useCallback(
|
||||
(option: Metric | AdhocMetric | string, index: number) => (
|
||||
@@ -262,12 +265,14 @@ export const DndMetricSelect = (props: any) => {
|
||||
onMoveLabel={moveLabel}
|
||||
onDropLabel={handleDropLabel}
|
||||
type={`${DndItemType.AdhocMetricOption}_${props.name}_${props.label}`}
|
||||
multi={multi}
|
||||
/>
|
||||
),
|
||||
[
|
||||
getSavedMetricOptionsForMetric,
|
||||
handleDropLabel,
|
||||
moveLabel,
|
||||
multi,
|
||||
onMetricEdit,
|
||||
onRemoveMetric,
|
||||
props.columns,
|
||||
|
||||
Reference in New Issue
Block a user