From 8943a2bcad457ad06f630f184b50dd7819969101 Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Tue, 17 Dec 2024 11:47:56 -0700 Subject: [PATCH] fix(multi-select): Update selected state when pill is removed --- .../multi-select/lib/MultiSelectedList.tsx | 4 ++-- .../multi-select/lib/useMultiSelectModel.ts | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/preview-react/multi-select/lib/MultiSelectedList.tsx b/modules/preview-react/multi-select/lib/MultiSelectedList.tsx index 671a9092d8..4818b871c1 100644 --- a/modules/preview-react/multi-select/lib/MultiSelectedList.tsx +++ b/modules/preview-react/multi-select/lib/MultiSelectedList.tsx @@ -10,7 +10,7 @@ export interface MultiSelectedListProps extends MultiSelectedItemProps, React.HTMLAttributes {} -export const MultiSelectedList = createSubcomponent()({ +export const MultiSelectedList = createSubcomponent('div')({ modelHook: useMultiSelectModel, })(({'aria-labelledby': ariaLabelledBy, removeLabel}, Element, model) => { return model.selected.state.items.length ? ( @@ -18,7 +18,7 @@ export const MultiSelectedList = createSubcomponent()({
item.id !== id)); }, shouldVirtualize: false, items: model.state.visibility === 'hidden' ? cachedSelected : selectedItems, }); - const state = { - ...model.state, - }; - - const events = { - ...model.events, - }; - return { selected: { ...selected, @@ -94,7 +87,5 @@ export const useMultiSelectModel = createModelHook({ }, }, ...model, - state, - events, }; });