Skip to content

Commit

Permalink
Only deduplicate canvas controls if their keys match (#6208)
Browse files Browse the repository at this point in the history
## Problem
The canvas control deduplication logic only takes into account the
control components. This can be problematic we want to render multiple
instances of the same component (for example, multiple grid controls in
#6203). With the current
code, only one of each type of control is kept.

## Fix
When the uniqueness check is performed, take into account both the
control component and the key supplied with the control. This way,
multiple instances of the same control component can be rendered
(provided their keys are unique, which for example can be done by
including the strategy name and/or a selected element path in the key)
  • Loading branch information
bkrmendy authored Aug 8, 2024
1 parent ba4668a commit 9a04be6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ export function useGetApplicableStrategyControls(): Array<ControlWithProps<unkno
applicableControls = addAllUniquelyBy(
applicableControls,
strategyControls,
(l, r) => l.control === r.control,
(l, r) => l.control === r.control && l.key === r.key,
)
}
// Special case controls.
Expand Down

0 comments on commit 9a04be6

Please sign in to comment.