Skip to content

Home > @liquidrazor/list-display > UseListCoreResult

UseListCoreResult interface

Contract returned by useListCore(). It aggregates the current list state as well as callbacks to mutate filters, sorting, pagination, and selection. Action-oriented handlers are also exposed to keep the UI layer thin and declarative.

Signature:

typescript
export interface UseListCoreResult<TRow = any, TRowId extends RowId = RowId>

Properties

Property

Modifiers

Type

Description

cancelActiveAction

() => void

Cancels the currently active action modal.

clearSelection

() => void

Clears all selections regardless of mode.

confirmActiveAction

(payload?: unknown) => Promise<void>

Confirms the currently active action modal.

exportState

() => ListSnapshot<TRow, TRowId>

Exports the current state into a serializable snapshot.

fields

Array<FieldSchema<TRow>>

Field schema definitions used to interpret rows.

generalActions?

Array<GeneralAction<TRow, TRowId>>

(Optional) General actions configured for the list.

refresh

() => Promise<void>

Refreshes the data source and recomputes derived state.

rowActions?

Array<RowAction<TRow, TRowId>>

(Optional) Row-level actions configured for the list.

selectAllVisible

() => void

Selects all rows currently visible in the paginated slice.

setFilters

(updater: (prev: ListState<TRow>["filters"]) => ListState<TRow>["filters"]) => void

Updates the active filters map.

setPageIndex

(pageIndex: number) => void

Moves to the specified page index.

setPageSize

(pageSize: number) => void

Updates the number of rows per page.

setSort

(sort: ListState<TRow>["sort"] | undefined) => void

Sets the active sort descriptor.

state

ListState<TRow>

Latest list state produced by the hook.

triggerGeneralAction

(actionId: string) => Promise<void>

Triggers the handler for a general action by id.

triggerRowAction

(actionId: string, rowIndex: number) => Promise<void>

Triggers the handler for a row action by id and row index.