GitHub

DaffSearchStateReducerAdapter

Manages DaffSearchReducerState.

import { DaffSearchStateReducerAdapter } from '@daffodil/search/state'
class DaffSearchStateReducerAdapter<<T extends DaffSearchResult = DaffSearchResult>>  {
  search(query: string): DaffSearchReducerState<T>
  storeResults(collection: Record<T["kind"], T[]>): DaffSearchReducerState<T>
  storeError(error: DaffStateError): DaffSearchReducerState<T>
}

Properties

Name Type Description
search DaffSearchReducerState<T>

Begins the search operation flow. Sets loading to true and stores the query in the list of recent searches. Resets the collection of results.

storeResults DaffSearchReducerState<T>

Stores the results of a completed search. Also sets loading to false and resets errors.

storeError DaffSearchReducerState<T>

Stores the from a failed search. Also sets loading to false.