(
state: UseComboboxState<SearchResult<string>>,
actionAndChanges: UseComboboxStateChangeOptions<SearchResult<string>>
)
| 57 | }); |
| 58 | |
| 59 | function comboboxReducer( |
| 60 | state: UseComboboxState<SearchResult<string>>, |
| 61 | actionAndChanges: UseComboboxStateChangeOptions<SearchResult<string>> |
| 62 | ): Partial<UseComboboxState<SearchResult<string>>> { |
| 63 | const { changes, ...action } = actionAndChanges; |
| 64 | |
| 65 | // Don't update the input field when selecting an item |
| 66 | switch (action.type) { |
| 67 | case useCombobox.stateChangeTypes.ItemClick: |
| 68 | case useCombobox.stateChangeTypes.InputKeyDownEnter: { |
| 69 | return { |
| 70 | ...changes, |
| 71 | inputValue: state.inputValue, |
| 72 | }; |
| 73 | } |
| 74 | default: |
| 75 | return changes; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | const cb = useCombobox({ |
| 80 | items: searchState.results ?? [], |
nothing calls this directly
no outgoing calls
no test coverage detected