DaffCollectionStateAdapter
Provides an abstracted way to manage a collection state.
import { DaffCollectionStateAdapter } from '@daffodil/core/state'
class DaffCollectionStateAdapter<<T extends DaffCollectionMetadata = DaffCollectionMetadata>> {
storeRequest(
request: DaffCollectionRequest
state: T
): T
setPageSize(
size: number
state: T
): T
setCurrentPage(
page: number
state: T
): T
setSort(
option: string
direction: string
state: T
): T
setFilters(
filters: Record<string, DaffFilter>
state: T
): T
setMetadata(
metadata: DaffCollectionMetadata
state: T
): T
}
Properties
Name | Type | Description |
---|---|---|
storeRequest | T | Stores a collection request in state. This is useful when you want to preemptively reduce a request before waiting for a response. |
setPageSize | T | Sets the page size. |
setCurrentPage | T | Sets the current page. |
setSort | T | Sets the sorting option and direction. |
setFilters | T | Sets the collection filters. |
setMetadata | T | Set the entire collection metadata at once. |