MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / comboboxReducer

Function comboboxReducer

app/components/SearchPalette.tsx:59–77  ·  view source on GitHub ↗
(
    state: UseComboboxState<SearchResult<string>>,
    actionAndChanges: UseComboboxStateChangeOptions<SearchResult<string>>
  )

Source from the content-addressed store, hash-verified

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 ?? [],

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected