Skip to content

Commit b25b6a4

Browse files
committed
fix: ensure the all items selected message is always shown when applicable
state.options contains the source list, selectedItems contains all selected items which might also be present in state.options. Looking at the 2 lists lenghts does not work because selectedItems can of course have other data items besides the options added from the source list. The fix is to check that all state.options id are found in selecteItems.
1 parent 3d91dca commit b25b6a4

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,15 @@ export const ItemOptionsSelector = ({
186186
searchTerm={debouncedSearchTerm}
187187
options={state.options}
188188
allItemsSelectedMessage={
189-
state.options.length === selectedItems.length &&
190-
!state.nextPage
189+
state.options.every((sourceItem) =>
190+
Boolean(
191+
selectedItems?.find(
192+
(selectedItem) =>
193+
sourceItem.value ===
194+
selectedItem.value
195+
)
196+
)
197+
) && !state.nextPage
191198
? i18n.t(
192199
'All available options are already selected'
193200
)

0 commit comments

Comments
 (0)