🐛(react) fix failing selection of last removed item
Previsouly when selecting item A and then removing it, it was impossible to select it again. This was caused by the internal memory of useSelect that only provides undefined selectedItem inside the onStateChange callback when the item has not changed. So by forcing it everytime to null it is now providing it everytime.
This commit is contained in:
@@ -37,7 +37,7 @@ export const SelectMultiSearchable = (props: SubProps) => {
|
||||
items: options,
|
||||
itemToString: optionToString,
|
||||
defaultHighlightedIndex: 0, // after selection, highlight the first item.
|
||||
selectedItem: null,
|
||||
selectedItem: null, // Important, without this we are not able to re-select the last removed option.
|
||||
stateReducer: (state, actionAndChanges) => {
|
||||
const { changes, type } = actionAndChanges;
|
||||
switch (type) {
|
||||
|
||||
Reference in New Issue
Block a user