tanstack-table
@noy-db/in-tanstack-table·pnpm add @noy-db/hub @noy-db/in-tanstack-tableTanStack Table bridge for noy-db — pure adapter, no React / Vue / Solid coupling.
What it does
buildQueryFromTableState(query, state) applies a Table TableState
(sorting, column filters, pagination) onto a noy-db Query<T> chain:
filters become .where(id, '==' | 'in', value), sorts become repeated
.orderBy(), pagination becomes .offset().limit() — covering the common
case; consumers needing richer operators (>=, ranges) extend it with a
custom filter mapper. tableStateFromQuery(query) does the reverse, for
round-tripping Table state through a URL or localStorage.
resetTableState(pageSize?) returns an empty, first-page state for
"clear all" buttons. Pair it with @tanstack/react-table,
@tanstack/vue-table, etc. to wire it into a component.
Usage
import { buildQueryFromTableState } from '@noy-db/in-tanstack-table'
const rows = buildQueryFromTableState(vault.collection('invoices').query(), tableState).toArray()
See also
- in-* family
- tanstack-query — pairs with this for data fetching/caching