Skip to content

Commit f4ba02c

Browse files
committed
fix: added listSelectedElements() instead of exposing the selectedElements
1 parent d0eb90d commit f4ba02c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/webui/src/client/ui/RundownView/SelectedElementsContext.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ interface AdlibActionElement {
4141
type SelectedElement = RundownElement | SegmentElement | PartInstanceElement | PieceElement | AdlibActionElement
4242

4343
interface SelectionContextType {
44-
selectedElements: Map<string, SelectedElement>
4544
isSelected: (elementId: string) => boolean
45+
listSelectedElements: () => SelectedElement[]
4646
clearAndSetSelection: (element: SelectedElement) => void
4747
toggleSelection: (element: SelectedElement) => void
4848
addSelection: (element: SelectedElement) => void
@@ -110,12 +110,14 @@ export const SelectedElementProvider: React.FC<{
110110

111111
const value = React.useMemo(
112112
() => ({
113-
selectedElements,
114-
115113
isSelected: (elementId: string) => {
116114
return selectedElements.has(elementId)
117115
},
118116

117+
listSelectedElements: () => {
118+
return Array.from(selectedElements.values())
119+
},
120+
119121
clearAndSetSelection: (element: SelectedElement) => {
120122
dispatch({ type: 'CLEAR_AND_SET_SELECTION', payload: element })
121123
},

0 commit comments

Comments
 (0)