File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
packages/compass-data-modeling/src/components Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -141,14 +141,27 @@ function SelectCollectionsStep({
141141 } ) }
142142 columns = { [ [ 'id' , 'Collection Name' ] ] }
143143 onChange = { ( items ) => {
144- const selectedItems = items
144+ // When a user is searching, less collections are shown to the user
145+ // and we need to keep existing selected collections selected.
146+ const currentSelectedItems = selectedCollections . filter (
147+ ( collName ) => {
148+ const item = items . find ( ( x ) => x . id === collName ) ;
149+ // The already selected item was not shown to the user (using search),
150+ // and we have to keep it selected.
151+ return item ? item . selected : true ;
152+ }
153+ ) ;
154+
155+ const newSelectedItems = items
145156 . filter ( ( item ) => {
146157 return item . selected ;
147158 } )
148159 . map ( ( item ) => {
149160 return item . id ;
150161 } ) ;
151- onCollectionsSelect ( selectedItems ) ;
162+ onCollectionsSelect (
163+ Array . from ( new Set ( [ ...newSelectedItems , ...currentSelectedItems ] ) )
164+ ) ;
152165 } }
153166 > </ SelectTable >
154167 </ FormFieldContainer >
You can’t perform that action at this time.
0 commit comments