API reference
useFilters
The hook — signature, return value, and options.
useFilters(configs, options?) => UseFiltersReturn
useFilters<P>(configs, options?) => UseFiltersReturn // validate against an API typeconfigs— a map ofkey → f.*(). See The filter config.options— per-call options (below).<P>— optional API params type to validate the config against; see Typed params.
Return value
| Property | Type | Description |
|---|---|---|
params | object | Committed values + pagination ({ page, per_page } by default). Fetch input & cache key. Array-shaped values are JS arrays, or joined strings under request.arrayFormat. |
paramsStr | string | params as a deterministic, sorted string — a stable cache key / memo dependency. |
filters | ResolvedFilter[] | Visible filters to render. Excludes hidden ones. |
filterMap | Record<key, ResolvedFilter> | Same filters keyed by config key. Includes hidden ones. |
isFiltered | boolean | true when at least one visible filter differs from its default. |
isDirty | boolean | true when a change hasn't reached params yet. |
apply | () => void | Commit all pending (debounced/manual) changes now. |
cancel | () => void | Discard all pending changes, reverting to committed values. |
reset | () => void | Clear every filter to its default, respecting each filter's commit mode (manual/debounced ones stage a draft until apply()). |
instantReset | () => void | Clear every filter to its default, bypassing commit — one immediate batched URL write. Use for a "Clear all" button. |
setFilter | (key, value) => void | Imperatively set one filter (resets to first page, bypasses commit). |
meta | FiltersMeta | The meta you passed (or {}). |
Options (second argument)
These override the createFilters config for this call.
Precedence: per-filter › this option › factory config › default.
| Option | Default | Description |
|---|---|---|
pagination | true | false disables pagination; an object overrides defaultPerPage / resetPageOnFilterChange. Keys and firstPage stay factory-only. |
defaultCommit | factory value | Default commit mode for all filters this call. See Values & commits. |
arraySeparator | factory value | Delimiter for array-shaped params for this call. |
history | 'replace' | 'push' makes filter changes back-button navigable. |
shallow | true | Keep navigation client-side (no server round-trip). |
clearOnDefault | true | Drop a param from the URL when it returns to its default. |
listeners | {} | Side-effect hooks — onParamsChange. See Listeners. |
meta | {} | Whole-set UI hints. See UI metadata. |
The shape of each resolved filter is documented under Types.