@tanstack/react-table 9.0.0-alpha.48 → 9.0.0-alpha.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/FlexRender.cjs.map +1 -1
  2. package/dist/FlexRender.js.map +1 -1
  3. package/dist/Subscribe.cjs +0 -1
  4. package/dist/Subscribe.cjs.map +1 -1
  5. package/dist/Subscribe.js.map +1 -1
  6. package/dist/createTableHook.cjs.map +1 -1
  7. package/dist/createTableHook.js.map +1 -1
  8. package/dist/reactivity.cjs +0 -1
  9. package/dist/reactivity.cjs.map +1 -1
  10. package/dist/reactivity.js.map +1 -1
  11. package/dist/useLegacyTable.cjs +0 -1
  12. package/dist/useLegacyTable.cjs.map +1 -1
  13. package/dist/useLegacyTable.d.cts +2 -3
  14. package/dist/useLegacyTable.d.ts +2 -3
  15. package/dist/useLegacyTable.js.map +1 -1
  16. package/dist/useTable.cjs +0 -1
  17. package/dist/useTable.cjs.map +1 -1
  18. package/dist/useTable.d.cts +12 -2
  19. package/dist/useTable.d.ts +12 -2
  20. package/dist/useTable.js.map +1 -1
  21. package/package.json +5 -5
  22. package/skills/react/client-to-server/SKILL.md +1 -1
  23. package/skills/react/compose-with-tanstack-form/SKILL.md +1 -1
  24. package/skills/react/compose-with-tanstack-pacer/SKILL.md +1 -1
  25. package/skills/react/compose-with-tanstack-query/SKILL.md +1 -1
  26. package/skills/react/compose-with-tanstack-store/SKILL.md +2 -2
  27. package/skills/react/compose-with-tanstack-virtual/SKILL.md +1 -1
  28. package/skills/react/getting-started/SKILL.md +1 -1
  29. package/skills/react/migrate-v8-to-v9/SKILL.md +5 -5
  30. package/skills/react/production-readiness/SKILL.md +2 -2
  31. package/skills/react/react-subscribe-compiler-compat/SKILL.md +1 -1
  32. package/skills/react/table-state/SKILL.md +2 -2
  33. package/src/useLegacyTable.ts +1 -1
  34. package/src/useTable.ts +13 -3
@@ -1 +1 @@
1
- {"version":3,"file":"useLegacyTable.cjs","names":["filterFns","sortFns","aggregationFns","useTable","stockFeatures"],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `_rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `_rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `_rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `_rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `_rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `_features` and `_rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `_features` and `_rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n '_features' | '_rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.store.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>() {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `_features` and `_rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const _features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * _features,\n * _rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `_rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [_rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n _features: stockFeatures,\n _rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAoDA,SAAgB,sBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,oBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,wBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,sBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,qBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,qBAEmB;CACjC,oBAAoB;;;;;;;;AAStB,SAAgB,yBAEuB;CACrC,mBAAmB;;;;;;;;AASrB,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,KAAK;;;;;;;;AAS9B,SAAgB,kBAEY;CAC1B,oBAAoB;;;;;;;;AAiMtB,SAAgB,2BAAkD;CAChE,qDAAiD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCnD,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,wCAA6B;EAClC,MAAM,YAAuD,EAAE;EAK/D,IAAI,qBACF,UAAU,oEAA0C;GAClD,GAAGA;GACH,GAAG,QAAQ;GACZ,CAAC;EAGJ,IAAI,mBACF,UAAU,gEAAsC;GAC9C,GAAGC;GACH,GAAG,QAAQ;GACZ,CAAC;EAGJ,IAAI,uBACF,UAAU,uEAA6C;EAGzD,IAAI,qBACF,UAAU,qEAA2C;EAGvD,IAAI,oBACF,UAAU,kEAAwC;GAChD,GAAGC;GACH,GAAG,QAAQ;GACZ,CAAC;EAGJ,IAAI,oBACF,UAAU,mEAAyC;EAGrD,IAAI,wBACF,UAAU,2EAAiD;EAG7D,IAAI,wBACF,UAAU,2EAAiD;EAG7D,OAAO;GACP;CAGF,MAAM,QAAQC,0BACZ;EACE,GAAG;EACH,WAAWC;EACX;EACD,GACA,UAAU,MACZ;CAED,MAAM,wCAA6B;EACjC,OAAO,MAAM;IACZ,CAAC,MAAM,CAAC;CAEX,MAAM,mCACH,UAAqC;EACpC,OAAO,QAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,KAAK,IAAI,MAAM;IAC/B;IAEJ,CAAC,MAAM,CACR;CAED,iCACS;EACL,GAAG;EACH;EACA;EACD,GACD;EAAC;EAAO;EAAU;EAAS,CAC5B"}
1
+ {"version":3,"file":"useLegacyTable.cjs","names":["filterFns","sortFns","aggregationFns","useTable","stockFeatures"],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `_rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `_rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `_rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `_rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `_rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `_features` and `_rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `_features` and `_rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n '_features' | '_rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>() {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `_features` and `_rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const _features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * _features,\n * _rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `_rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [_rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n _features: stockFeatures,\n _rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,oBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,wBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEmB;CACjC,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mBAAmB;AACrB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,IAAI;AAC7B;;;;;;;AAQA,SAAgB,kBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAgMA,SAAgB,2BAAkD;CAChE,oDAAgD;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,wCAA6B;EAClC,MAAM,YAAuD,CAAC;EAK9D,IAAI,qBACF,UAAU,oEAA0C;GAClD,GAAGA;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,mBACF,UAAU,gEAAsC;GAC9C,GAAGC;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,uBACF,UAAU,sEAA4C;EAGxD,IAAI,qBACF,UAAU,oEAA0C;EAGtD,IAAI,oBACF,UAAU,kEAAwC;GAChD,GAAGC;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,oBACF,UAAU,kEAAwC;EAGpD,IAAI,wBACF,UAAU,0EAAgD;EAG5D,IAAI,wBACF,UAAU,0EAAgD;EAG5D,OAAO;CACT,CAAC;CAGD,MAAM,QAAQC,0BACZ;EACE,GAAG;EACH,WAAWC;EACX;CACF,IACC,UAAU,KACb;CAEA,MAAM,wCAA6B;EACjC,OAAO,MAAM;CACf,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,mCACH,UAAqC;EACpC,OAAO,QAAQ,KAAK,EAAE,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,KAAK,IAAI,KAAK;EAChC,CAAC;CACH,GACA,CAAC,KAAK,CACR;CAEA,iCACS;EACL,GAAG;EACH;EACA;CACF,IACA;EAAC;EAAO;EAAU;CAAQ,CAC5B;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { ReactTable } from "./useTable.cjs";
2
- import * as _$_tanstack_table_core0 from "@tanstack/table-core";
3
2
  import { AggregationFns, Cell, Column, ColumnDef, FilterFns, Header, HeaderGroup, Row, RowData, RowModel, SortFns, StockFeatures, Table, TableOptions, TableState } from "@tanstack/table-core";
4
3
 
5
4
  //#region src/useLegacyTable.d.ts
@@ -164,7 +163,7 @@ type LegacyTableOptions<TData extends RowData> = Omit<TableOptions<StockFeatures
164
163
  type LegacyReactTable<TData extends RowData> = ReactTable<StockFeatures, TData, TableState<StockFeatures>> & {
165
164
  /**
166
165
  * Returns the current table state.
167
- * @deprecated In v9, access state directly via `table.state` or use `table.store.state` for the full state.
166
+ * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.
168
167
  */
169
168
  getState: () => TableState<StockFeatures>;
170
169
  /**
@@ -193,7 +192,7 @@ type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>;
193
192
  * A column helper with StockFeatures pre-bound for use with useLegacyTable.
194
193
  * Only requires TData—no need to specify TFeatures.
195
194
  */
196
- declare function legacyCreateColumnHelper<TData extends RowData>(): _$_tanstack_table_core0.ColumnHelper<StockFeatures, TData>;
195
+ declare function legacyCreateColumnHelper<TData extends RowData>(): import("@tanstack/table-core").ColumnHelper<StockFeatures, TData>;
197
196
  /**
198
197
  * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.
199
198
  *
@@ -1,5 +1,4 @@
1
1
  import { ReactTable } from "./useTable.js";
2
- import * as _$_tanstack_table_core0 from "@tanstack/table-core";
3
2
  import { AggregationFns, Cell, Column, ColumnDef, FilterFns, Header, HeaderGroup, Row, RowData, RowModel, SortFns, StockFeatures, Table, TableOptions, TableState } from "@tanstack/table-core";
4
3
 
5
4
  //#region src/useLegacyTable.d.ts
@@ -164,7 +163,7 @@ type LegacyTableOptions<TData extends RowData> = Omit<TableOptions<StockFeatures
164
163
  type LegacyReactTable<TData extends RowData> = ReactTable<StockFeatures, TData, TableState<StockFeatures>> & {
165
164
  /**
166
165
  * Returns the current table state.
167
- * @deprecated In v9, access state directly via `table.state` or use `table.store.state` for the full state.
166
+ * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.
168
167
  */
169
168
  getState: () => TableState<StockFeatures>;
170
169
  /**
@@ -193,7 +192,7 @@ type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>;
193
192
  * A column helper with StockFeatures pre-bound for use with useLegacyTable.
194
193
  * Only requires TData—no need to specify TFeatures.
195
194
  */
196
- declare function legacyCreateColumnHelper<TData extends RowData>(): _$_tanstack_table_core0.ColumnHelper<StockFeatures, TData>;
195
+ declare function legacyCreateColumnHelper<TData extends RowData>(): import("@tanstack/table-core").ColumnHelper<StockFeatures, TData>;
197
196
  /**
198
197
  * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.
199
198
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useLegacyTable.js","names":[],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `_rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `_rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `_rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `_rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `_rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `_features` and `_rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `_features` and `_rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n '_features' | '_rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.store.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>() {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `_features` and `_rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const _features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * _features,\n * _rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `_rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [_rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n _features: stockFeatures,\n _rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,SAAgB,sBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,oBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,wBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,sBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,qBAEY;CAC1B,oBAAoB;;;;;;;;AAStB,SAAgB,qBAEmB;CACjC,oBAAoB;;;;;;;;AAStB,SAAgB,yBAEuB;CACrC,mBAAmB;;;;;;;;AASrB,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,KAAK;;;;;;;;AAS9B,SAAgB,kBAEY;CAC1B,oBAAoB;;;;;;;;AAiMtB,SAAgB,2BAAkD;CAChE,OAAO,oBAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCnD,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,cAAc,eAAe;EAClC,MAAM,YAAuD,EAAE;EAK/D,IAAI,qBACF,UAAU,mBAAmB,uBAAuB;GAClD,GAAG;GACH,GAAG,QAAQ;GACZ,CAAC;EAGJ,IAAI,mBACF,UAAU,iBAAiB,qBAAqB;GAC9C,GAAG;GACH,GAAG,QAAQ;GACZ,CAAC;EAGJ,IAAI,uBACF,UAAU,oBAAoB,yBAAyB;EAGzD,IAAI,qBACF,UAAU,mBAAmB,wBAAwB;EAGvD,IAAI,oBACF,UAAU,kBAAkB,sBAAsB;GAChD,GAAG;GACH,GAAG,QAAQ;GACZ,CAAC;EAGJ,IAAI,oBACF,UAAU,kBAAkB,uBAAuB;EAGrD,IAAI,wBACF,UAAU,sBAAsB,2BAA2B;EAG7D,IAAI,wBACF,UAAU,sBAAsB,2BAA2B;EAG7D,OAAO;GACP;CAGF,MAAM,QAAQ,SACZ;EACE,GAAG;EACH,WAAW;EACX;EACD,GACA,UAAU,MACZ;CAED,MAAM,WAAW,kBAAkB;EACjC,OAAO,MAAM;IACZ,CAAC,MAAM,CAAC;CAEX,MAAM,WAAW,aACd,UAAqC;EACpC,OAAO,QAAQ,MAAM,CAAC,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,KAAK,IAAI,MAAM;IAC/B;IAEJ,CAAC,MAAM,CACR;CAED,OAAO,eACE;EACL,GAAG;EACH;EACA;EACD,GACD;EAAC;EAAO;EAAU;EAAS,CAC5B"}
1
+ {"version":3,"file":"useLegacyTable.js","names":[],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `_rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `_rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `_rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `_rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `_rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `_rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `_rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `_rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `_features` and `_rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `_features` and `_rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n '_features' | '_rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>() {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `_features` and `_rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const _features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * _features,\n * _rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `_rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [_rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n _features: stockFeatures,\n _rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,oBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,wBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEmB;CACjC,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mBAAmB;AACrB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,IAAI;AAC7B;;;;;;;AAQA,SAAgB,kBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAgMA,SAAgB,2BAAkD;CAChE,OAAO,mBAAyC;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,cAAc,eAAe;EAClC,MAAM,YAAuD,CAAC;EAK9D,IAAI,qBACF,UAAU,mBAAmB,uBAAuB;GAClD,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,mBACF,UAAU,iBAAiB,qBAAqB;GAC9C,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,uBACF,UAAU,oBAAoB,wBAAwB;EAGxD,IAAI,qBACF,UAAU,mBAAmB,uBAAuB;EAGtD,IAAI,oBACF,UAAU,kBAAkB,sBAAsB;GAChD,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,oBACF,UAAU,kBAAkB,sBAAsB;EAGpD,IAAI,wBACF,UAAU,sBAAsB,0BAA0B;EAG5D,IAAI,wBACF,UAAU,sBAAsB,0BAA0B;EAG5D,OAAO;CACT,CAAC;CAGD,MAAM,QAAQ,SACZ;EACE,GAAG;EACH,WAAW;EACX;CACF,IACC,UAAU,KACb;CAEA,MAAM,WAAW,kBAAkB;EACjC,OAAO,MAAM;CACf,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,WAAW,aACd,UAAqC;EACpC,OAAO,QAAQ,KAAK,EAAE,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,KAAK,IAAI,KAAK;EAChC,CAAC;CACH,GACA,CAAC,KAAK,CACR;CAEA,OAAO,eACE;EACL,GAAG;EACH;EACA;CACF,IACA;EAAC;EAAO;EAAU;CAAQ,CAC5B;AACF"}
package/dist/useTable.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
4
3
  const require_FlexRender = require('./FlexRender.cjs');
5
4
  const require_Subscribe = require('./Subscribe.cjs');
6
5
  const require_reactivity = require('./reactivity.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.cjs","names":["reactReactivity","Subscribe","FlexRender","shallow"],"sources":["../src/useTable.ts"],"sourcesContent":["'use client'\n\nimport { useMemo, useState } from 'react'\nimport { constructTable } from '@tanstack/table-core'\nimport { shallow, useSelector } from '@tanstack/react-store'\nimport { reactReactivity } from './reactivity'\nimport { FlexRender } from './FlexRender'\nimport { Subscribe } from './Subscribe'\nimport type { FlexRenderProps } from './FlexRender'\nimport type { SubscribePropsWithStore, SubscribeSource } from './Subscribe'\nimport type {\n CellData,\n RowData,\n Table,\n TableFeatures,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { FunctionComponent, ReactNode } from 'react'\n\nexport type ReactTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n> = Table<TFeatures, TData> & {\n /**\n * A React HOC (Higher Order Component) that allows you to subscribe to the table state.\n *\n * This is useful for opting into state re-renders for specific parts of the table state.\n *\n * Pass `source` to subscribe to a single atom or store (e.g. `table.atoms.rowSelection`\n * or `table.optionsStore`) instead of the full `table.store`.\n *\n * @example\n * <table.Subscribe selector={(state) => ({ rowSelection: state.rowSelection })}>\n * {({ rowSelection }) => (\n * <tr key={row.id}>...</tr>\n * )}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection}>\n * {(rowSelection) => <div>...</div>}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection} selector={(s) => s?.[row.id]}>\n * {() => <tr key={row.id}>...</tr>}\n * </table.Subscribe>\n */\n /**\n * Overloads (not a single union) so `selector` callbacks get correct contextual\n * types in JSX; a union of two `selector` signatures degrades to implicit `any`.\n *\n * Source **without** `selector` is a separate overload so children receive `TSourceValue`\n * (identity projection). If `selector` were optional on one overload, `TSubSelected`\n * would default to `unknown` instead of inferring from the source.\n *\n * The **source** overloads are listed first so `TSourceValue` is inferred from `source`.\n */\n Subscribe: {\n <TSourceValue>(props: {\n source: SubscribeSource<TSourceValue>\n selector?: undefined\n children: ((state: TSourceValue) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSourceValue, TSubSelected>(props: {\n source: SubscribeSource<TSourceValue>\n selector: (state: TSourceValue) => TSubSelected\n children: ((state: TSubSelected) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSubSelected>(\n props: Omit<SubscribePropsWithStore<TFeatures, TSubSelected>, 'source'>,\n ): ReturnType<FunctionComponent>\n }\n /**\n * A React component that renders headers, cells, or footers with custom markup.\n * Use this utility component instead of manually calling flexRender.\n *\n * @example\n * ```tsx\n * <table.FlexRender cell={cell} />\n * <table.FlexRender header={header} />\n * <table.FlexRender footer={footer} />\n * ```\n *\n * This replaces calling `flexRender` directly like this:\n * ```tsx\n * flexRender(cell.column.columnDef.cell, cell.getContext())\n * flexRender(header.column.columnDef.header, header.getContext())\n * flexRender(footer.column.columnDef.footer, footer.getContext())\n * ```\n */\n FlexRender: <TValue extends CellData = CellData>(\n props: FlexRenderProps<TFeatures, TData, TValue>,\n ) => ReactNode\n /**\n * The selected state of the table. This state may not match the structure of `table.store.state` because it is selected by the `selector` function that you pass as the 2nd argument to `useTable`.\n *\n * @example\n * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state\n *\n * console.log(table.state.globalFilter)\n */\n readonly state: Readonly<TSelected>\n}\n\n/**\n * Creates a React table instance backed by TanStack Store atoms.\n *\n * The optional selector projects from `table.store`; the selected value is\n * exposed on `table.state` and compared shallowly for React re-renders. Omit\n * the selector to subscribe to every registered table state slice, or pass a\n * narrower selector and use `table.Subscribe` lower in the tree for targeted\n * subscriptions.\n *\n * @example\n * ```tsx\n * const table = useTable(\n * {\n * _features,\n * _rowModels: {},\n * columns,\n * data,\n * },\n * (state) => ({ pagination: state.pagination }),\n * )\n *\n * table.state.pagination\n * ```\n */\nexport function useTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n>(\n tableOptions: TableOptions<TFeatures, TData>,\n selector?: (state: TableState<TFeatures>) => TSelected,\n): ReactTable<TFeatures, TData, TSelected> {\n const [table] = useState(() => {\n const tableInstance = constructTable({\n ...tableOptions,\n _features: {\n coreReativityFeature: reactReactivity(),\n ...tableOptions._features,\n },\n }) as ReactTable<TFeatures, TData, TSelected>\n\n tableInstance.Subscribe = ((props: any) => {\n const source = props.source ?? tableInstance.store\n\n return Subscribe({\n ...props,\n source,\n })\n }) as ReactTable<TFeatures, TData, TSelected>['Subscribe']\n\n tableInstance.FlexRender = FlexRender\n\n return tableInstance\n })\n\n // sync options on every render\n table.setOptions((prev) => ({\n ...prev,\n ...tableOptions,\n }))\n\n const state = useSelector(table.store, selector, { compare: shallow })\n\n // we know this is not the most efficient way to return the table,\n // but it is required for the react compiler to work\n return useMemo(\n () => ({\n ...table,\n options: tableOptions,\n state,\n }),\n [table, tableOptions, state],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmIA,SAAgB,SAKd,cACA,UACyC;CACzC,MAAM,CAAC,mCAAwB;EAC7B,MAAM,yDAA+B;GACnC,GAAG;GACH,WAAW;IACT,sBAAsBA,oCAAiB;IACvC,GAAG,aAAa;IACjB;GACF,CAAC;EAEF,cAAc,cAAc,UAAe;GACzC,MAAM,SAAS,MAAM,UAAU,cAAc;GAE7C,OAAOC,4BAAU;IACf,GAAG;IACH;IACD,CAAC;;EAGJ,cAAc,aAAaC;EAE3B,OAAO;GACP;CAGF,MAAM,YAAY,UAAU;EAC1B,GAAG;EACH,GAAG;EACJ,EAAE;CAEH,MAAM,+CAAoB,MAAM,OAAO,UAAU,EAAE,SAASC,+BAAS,CAAC;CAItE,iCACS;EACL,GAAG;EACH,SAAS;EACT;EACD,GACD;EAAC;EAAO;EAAc;EAAM,CAC7B"}
1
+ {"version":3,"file":"useTable.cjs","names":["reactReactivity","Subscribe","FlexRender","shallow"],"sources":["../src/useTable.ts"],"sourcesContent":["'use client'\n\nimport { useMemo, useState } from 'react'\nimport { constructTable } from '@tanstack/table-core'\nimport { shallow, useSelector } from '@tanstack/react-store'\nimport { reactReactivity } from './reactivity'\nimport { FlexRender } from './FlexRender'\nimport { Subscribe } from './Subscribe'\nimport type { FlexRenderProps } from './FlexRender'\nimport type { SubscribePropsWithStore, SubscribeSource } from './Subscribe'\nimport type {\n CellData,\n RowData,\n Table,\n TableFeatures,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { FunctionComponent, ReactNode } from 'react'\n\nexport type ReactTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n> = Omit<Table<TFeatures, TData>, 'store'> & {\n /**\n * @deprecated Prefer `table.state` for render reads,\n * `table.atoms.<slice>.get()` for slice snapshots, or\n * `table.Subscribe` / `useSelector(table.store, selector)` for explicit\n * subscriptions. `table.store.state` is a current-value snapshot and is easy\n * to misuse in render code.\n */\n readonly store: Table<TFeatures, TData>['store']\n /**\n * A React HOC (Higher Order Component) that allows you to subscribe to the table state.\n *\n * This is useful for opting into state re-renders for specific parts of the table state.\n *\n * Pass `source` to subscribe to a single atom or store (e.g. `table.atoms.rowSelection`\n * or `table.optionsStore`) instead of the full `table.store`.\n *\n * @example\n * <table.Subscribe selector={(state) => ({ rowSelection: state.rowSelection })}>\n * {({ rowSelection }) => (\n * <tr key={row.id}>...</tr>\n * )}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection}>\n * {(rowSelection) => <div>...</div>}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection} selector={(s) => s?.[row.id]}>\n * {() => <tr key={row.id}>...</tr>}\n * </table.Subscribe>\n */\n /**\n * Overloads (not a single union) so `selector` callbacks get correct contextual\n * types in JSX; a union of two `selector` signatures degrades to implicit `any`.\n *\n * Source **without** `selector` is a separate overload so children receive `TSourceValue`\n * (identity projection). If `selector` were optional on one overload, `TSubSelected`\n * would default to `unknown` instead of inferring from the source.\n *\n * The **source** overloads are listed first so `TSourceValue` is inferred from `source`.\n */\n Subscribe: {\n <TSourceValue>(props: {\n source: SubscribeSource<TSourceValue>\n selector?: undefined\n children: ((state: TSourceValue) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSourceValue, TSubSelected>(props: {\n source: SubscribeSource<TSourceValue>\n selector: (state: TSourceValue) => TSubSelected\n children: ((state: TSubSelected) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSubSelected>(\n props: Omit<SubscribePropsWithStore<TFeatures, TSubSelected>, 'source'>,\n ): ReturnType<FunctionComponent>\n }\n /**\n * A React component that renders headers, cells, or footers with custom markup.\n * Use this utility component instead of manually calling flexRender.\n *\n * @example\n * ```tsx\n * <table.FlexRender cell={cell} />\n * <table.FlexRender header={header} />\n * <table.FlexRender footer={footer} />\n * ```\n *\n * This replaces calling `flexRender` directly like this:\n * ```tsx\n * flexRender(cell.column.columnDef.cell, cell.getContext())\n * flexRender(header.column.columnDef.header, header.getContext())\n * flexRender(footer.column.columnDef.footer, footer.getContext())\n * ```\n */\n FlexRender: <TValue extends CellData = CellData>(\n props: FlexRenderProps<TFeatures, TData, TValue>,\n ) => ReactNode\n /**\n * The selected state of the table. This state may not match the structure of\n * the full table state because it is selected by the selector function that\n * you pass as the 2nd argument to `useTable`.\n *\n * @example\n * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state\n *\n * console.log(table.state.globalFilter)\n */\n readonly state: Readonly<TSelected>\n}\n\n/**\n * Creates a React table instance backed by TanStack Store atoms.\n *\n * The optional selector projects from `table.store`; the selected value is\n * exposed on `table.state` and compared shallowly for React re-renders. Omit\n * the selector to subscribe to every registered table state slice, or pass a\n * narrower selector and use `table.Subscribe` lower in the tree for targeted\n * subscriptions.\n *\n * @example\n * ```tsx\n * const table = useTable(\n * {\n * _features,\n * _rowModels: {},\n * columns,\n * data,\n * },\n * (state) => ({ pagination: state.pagination }),\n * )\n *\n * table.state.pagination\n * ```\n */\nexport function useTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n>(\n tableOptions: TableOptions<TFeatures, TData>,\n selector?: (state: TableState<TFeatures>) => TSelected,\n): ReactTable<TFeatures, TData, TSelected> {\n const [table] = useState(() => {\n const tableInstance = constructTable({\n ...tableOptions,\n _features: {\n coreReativityFeature: reactReactivity(),\n ...tableOptions._features,\n },\n }) as unknown as ReactTable<TFeatures, TData, TSelected>\n\n tableInstance.Subscribe = ((props: any) => {\n const source = props.source ?? tableInstance.store\n\n return Subscribe({\n ...props,\n source,\n })\n }) as ReactTable<TFeatures, TData, TSelected>['Subscribe']\n\n tableInstance.FlexRender = FlexRender\n\n return tableInstance\n })\n\n // sync options on every render\n table.setOptions((prev) => ({\n ...prev,\n ...tableOptions,\n }))\n\n const state = useSelector(table.store, selector, { compare: shallow })\n\n // we know this is not the most efficient way to return the table,\n // but it is required for the react compiler to work\n return useMemo(\n () => ({\n ...table,\n options: tableOptions,\n state,\n }),\n [table, tableOptions, state],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6IA,SAAgB,SAKd,cACA,UACyC;CACzC,MAAM,CAAC,mCAAwB;EAC7B,MAAM,yDAA+B;GACnC,GAAG;GACH,WAAW;IACT,sBAAsBA,mCAAgB;IACtC,GAAG,aAAa;GAClB;EACF,CAAC;EAED,cAAc,cAAc,UAAe;GACzC,MAAM,SAAS,MAAM,UAAU,cAAc;GAE7C,OAAOC,4BAAU;IACf,GAAG;IACH;GACF,CAAC;EACH;EAEA,cAAc,aAAaC;EAE3B,OAAO;CACT,CAAC;CAGD,MAAM,YAAY,UAAU;EAC1B,GAAG;EACH,GAAG;CACL,EAAE;CAEF,MAAM,+CAAoB,MAAM,OAAO,UAAU,EAAE,SAASC,8BAAQ,CAAC;CAIrE,iCACS;EACL,GAAG;EACH,SAAS;EACT;CACF,IACA;EAAC;EAAO;EAAc;CAAK,CAC7B;AACF"}
@@ -4,7 +4,15 @@ import { FunctionComponent, ReactNode } from "react";
4
4
  import { CellData, RowData, Table, TableFeatures, TableOptions, TableState } from "@tanstack/table-core";
5
5
 
6
6
  //#region src/useTable.d.ts
7
- type ReactTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>> = Table<TFeatures, TData> & {
7
+ type ReactTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>> = Omit<Table<TFeatures, TData>, 'store'> & {
8
+ /**
9
+ * @deprecated Prefer `table.state` for render reads,
10
+ * `table.atoms.<slice>.get()` for slice snapshots, or
11
+ * `table.Subscribe` / `useSelector(table.store, selector)` for explicit
12
+ * subscriptions. `table.store.state` is a current-value snapshot and is easy
13
+ * to misuse in render code.
14
+ */
15
+ readonly store: Table<TFeatures, TData>['store'];
8
16
  /**
9
17
  * A React HOC (Higher Order Component) that allows you to subscribe to the table state.
10
18
  *
@@ -73,7 +81,9 @@ type ReactTable<TFeatures extends TableFeatures, TData extends RowData, TSelecte
73
81
  */
74
82
  FlexRender: <TValue extends CellData = CellData>(props: FlexRenderProps<TFeatures, TData, TValue>) => ReactNode;
75
83
  /**
76
- * The selected state of the table. This state may not match the structure of `table.store.state` because it is selected by the `selector` function that you pass as the 2nd argument to `useTable`.
84
+ * The selected state of the table. This state may not match the structure of
85
+ * the full table state because it is selected by the selector function that
86
+ * you pass as the 2nd argument to `useTable`.
77
87
  *
78
88
  * @example
79
89
  * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state
@@ -4,7 +4,15 @@ import { CellData, RowData, Table, TableFeatures, TableOptions, TableState } fro
4
4
  import { FunctionComponent, ReactNode } from "react";
5
5
 
6
6
  //#region src/useTable.d.ts
7
- type ReactTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>> = Table<TFeatures, TData> & {
7
+ type ReactTable<TFeatures extends TableFeatures, TData extends RowData, TSelected = TableState<TFeatures>> = Omit<Table<TFeatures, TData>, 'store'> & {
8
+ /**
9
+ * @deprecated Prefer `table.state` for render reads,
10
+ * `table.atoms.<slice>.get()` for slice snapshots, or
11
+ * `table.Subscribe` / `useSelector(table.store, selector)` for explicit
12
+ * subscriptions. `table.store.state` is a current-value snapshot and is easy
13
+ * to misuse in render code.
14
+ */
15
+ readonly store: Table<TFeatures, TData>['store'];
8
16
  /**
9
17
  * A React HOC (Higher Order Component) that allows you to subscribe to the table state.
10
18
  *
@@ -73,7 +81,9 @@ type ReactTable<TFeatures extends TableFeatures, TData extends RowData, TSelecte
73
81
  */
74
82
  FlexRender: <TValue extends CellData = CellData>(props: FlexRenderProps<TFeatures, TData, TValue>) => ReactNode;
75
83
  /**
76
- * The selected state of the table. This state may not match the structure of `table.store.state` because it is selected by the `selector` function that you pass as the 2nd argument to `useTable`.
84
+ * The selected state of the table. This state may not match the structure of
85
+ * the full table state because it is selected by the selector function that
86
+ * you pass as the 2nd argument to `useTable`.
77
87
  *
78
88
  * @example
79
89
  * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","names":[],"sources":["../src/useTable.ts"],"sourcesContent":["'use client'\n\nimport { useMemo, useState } from 'react'\nimport { constructTable } from '@tanstack/table-core'\nimport { shallow, useSelector } from '@tanstack/react-store'\nimport { reactReactivity } from './reactivity'\nimport { FlexRender } from './FlexRender'\nimport { Subscribe } from './Subscribe'\nimport type { FlexRenderProps } from './FlexRender'\nimport type { SubscribePropsWithStore, SubscribeSource } from './Subscribe'\nimport type {\n CellData,\n RowData,\n Table,\n TableFeatures,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { FunctionComponent, ReactNode } from 'react'\n\nexport type ReactTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n> = Table<TFeatures, TData> & {\n /**\n * A React HOC (Higher Order Component) that allows you to subscribe to the table state.\n *\n * This is useful for opting into state re-renders for specific parts of the table state.\n *\n * Pass `source` to subscribe to a single atom or store (e.g. `table.atoms.rowSelection`\n * or `table.optionsStore`) instead of the full `table.store`.\n *\n * @example\n * <table.Subscribe selector={(state) => ({ rowSelection: state.rowSelection })}>\n * {({ rowSelection }) => (\n * <tr key={row.id}>...</tr>\n * )}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection}>\n * {(rowSelection) => <div>...</div>}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection} selector={(s) => s?.[row.id]}>\n * {() => <tr key={row.id}>...</tr>}\n * </table.Subscribe>\n */\n /**\n * Overloads (not a single union) so `selector` callbacks get correct contextual\n * types in JSX; a union of two `selector` signatures degrades to implicit `any`.\n *\n * Source **without** `selector` is a separate overload so children receive `TSourceValue`\n * (identity projection). If `selector` were optional on one overload, `TSubSelected`\n * would default to `unknown` instead of inferring from the source.\n *\n * The **source** overloads are listed first so `TSourceValue` is inferred from `source`.\n */\n Subscribe: {\n <TSourceValue>(props: {\n source: SubscribeSource<TSourceValue>\n selector?: undefined\n children: ((state: TSourceValue) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSourceValue, TSubSelected>(props: {\n source: SubscribeSource<TSourceValue>\n selector: (state: TSourceValue) => TSubSelected\n children: ((state: TSubSelected) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSubSelected>(\n props: Omit<SubscribePropsWithStore<TFeatures, TSubSelected>, 'source'>,\n ): ReturnType<FunctionComponent>\n }\n /**\n * A React component that renders headers, cells, or footers with custom markup.\n * Use this utility component instead of manually calling flexRender.\n *\n * @example\n * ```tsx\n * <table.FlexRender cell={cell} />\n * <table.FlexRender header={header} />\n * <table.FlexRender footer={footer} />\n * ```\n *\n * This replaces calling `flexRender` directly like this:\n * ```tsx\n * flexRender(cell.column.columnDef.cell, cell.getContext())\n * flexRender(header.column.columnDef.header, header.getContext())\n * flexRender(footer.column.columnDef.footer, footer.getContext())\n * ```\n */\n FlexRender: <TValue extends CellData = CellData>(\n props: FlexRenderProps<TFeatures, TData, TValue>,\n ) => ReactNode\n /**\n * The selected state of the table. This state may not match the structure of `table.store.state` because it is selected by the `selector` function that you pass as the 2nd argument to `useTable`.\n *\n * @example\n * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state\n *\n * console.log(table.state.globalFilter)\n */\n readonly state: Readonly<TSelected>\n}\n\n/**\n * Creates a React table instance backed by TanStack Store atoms.\n *\n * The optional selector projects from `table.store`; the selected value is\n * exposed on `table.state` and compared shallowly for React re-renders. Omit\n * the selector to subscribe to every registered table state slice, or pass a\n * narrower selector and use `table.Subscribe` lower in the tree for targeted\n * subscriptions.\n *\n * @example\n * ```tsx\n * const table = useTable(\n * {\n * _features,\n * _rowModels: {},\n * columns,\n * data,\n * },\n * (state) => ({ pagination: state.pagination }),\n * )\n *\n * table.state.pagination\n * ```\n */\nexport function useTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n>(\n tableOptions: TableOptions<TFeatures, TData>,\n selector?: (state: TableState<TFeatures>) => TSelected,\n): ReactTable<TFeatures, TData, TSelected> {\n const [table] = useState(() => {\n const tableInstance = constructTable({\n ...tableOptions,\n _features: {\n coreReativityFeature: reactReactivity(),\n ...tableOptions._features,\n },\n }) as ReactTable<TFeatures, TData, TSelected>\n\n tableInstance.Subscribe = ((props: any) => {\n const source = props.source ?? tableInstance.store\n\n return Subscribe({\n ...props,\n source,\n })\n }) as ReactTable<TFeatures, TData, TSelected>['Subscribe']\n\n tableInstance.FlexRender = FlexRender\n\n return tableInstance\n })\n\n // sync options on every render\n table.setOptions((prev) => ({\n ...prev,\n ...tableOptions,\n }))\n\n const state = useSelector(table.store, selector, { compare: shallow })\n\n // we know this is not the most efficient way to return the table,\n // but it is required for the react compiler to work\n return useMemo(\n () => ({\n ...table,\n options: tableOptions,\n state,\n }),\n [table, tableOptions, state],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmIA,SAAgB,SAKd,cACA,UACyC;CACzC,MAAM,CAAC,SAAS,eAAe;EAC7B,MAAM,gBAAgB,eAAe;GACnC,GAAG;GACH,WAAW;IACT,sBAAsB,iBAAiB;IACvC,GAAG,aAAa;IACjB;GACF,CAAC;EAEF,cAAc,cAAc,UAAe;GACzC,MAAM,SAAS,MAAM,UAAU,cAAc;GAE7C,OAAO,UAAU;IACf,GAAG;IACH;IACD,CAAC;;EAGJ,cAAc,aAAa;EAE3B,OAAO;GACP;CAGF,MAAM,YAAY,UAAU;EAC1B,GAAG;EACH,GAAG;EACJ,EAAE;CAEH,MAAM,QAAQ,YAAY,MAAM,OAAO,UAAU,EAAE,SAAS,SAAS,CAAC;CAItE,OAAO,eACE;EACL,GAAG;EACH,SAAS;EACT;EACD,GACD;EAAC;EAAO;EAAc;EAAM,CAC7B"}
1
+ {"version":3,"file":"useTable.js","names":[],"sources":["../src/useTable.ts"],"sourcesContent":["'use client'\n\nimport { useMemo, useState } from 'react'\nimport { constructTable } from '@tanstack/table-core'\nimport { shallow, useSelector } from '@tanstack/react-store'\nimport { reactReactivity } from './reactivity'\nimport { FlexRender } from './FlexRender'\nimport { Subscribe } from './Subscribe'\nimport type { FlexRenderProps } from './FlexRender'\nimport type { SubscribePropsWithStore, SubscribeSource } from './Subscribe'\nimport type {\n CellData,\n RowData,\n Table,\n TableFeatures,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { FunctionComponent, ReactNode } from 'react'\n\nexport type ReactTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n> = Omit<Table<TFeatures, TData>, 'store'> & {\n /**\n * @deprecated Prefer `table.state` for render reads,\n * `table.atoms.<slice>.get()` for slice snapshots, or\n * `table.Subscribe` / `useSelector(table.store, selector)` for explicit\n * subscriptions. `table.store.state` is a current-value snapshot and is easy\n * to misuse in render code.\n */\n readonly store: Table<TFeatures, TData>['store']\n /**\n * A React HOC (Higher Order Component) that allows you to subscribe to the table state.\n *\n * This is useful for opting into state re-renders for specific parts of the table state.\n *\n * Pass `source` to subscribe to a single atom or store (e.g. `table.atoms.rowSelection`\n * or `table.optionsStore`) instead of the full `table.store`.\n *\n * @example\n * <table.Subscribe selector={(state) => ({ rowSelection: state.rowSelection })}>\n * {({ rowSelection }) => (\n * <tr key={row.id}>...</tr>\n * )}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection}>\n * {(rowSelection) => <div>...</div>}\n * </table.Subscribe>\n *\n * @example\n * <table.Subscribe source={table.atoms.rowSelection} selector={(s) => s?.[row.id]}>\n * {() => <tr key={row.id}>...</tr>}\n * </table.Subscribe>\n */\n /**\n * Overloads (not a single union) so `selector` callbacks get correct contextual\n * types in JSX; a union of two `selector` signatures degrades to implicit `any`.\n *\n * Source **without** `selector` is a separate overload so children receive `TSourceValue`\n * (identity projection). If `selector` were optional on one overload, `TSubSelected`\n * would default to `unknown` instead of inferring from the source.\n *\n * The **source** overloads are listed first so `TSourceValue` is inferred from `source`.\n */\n Subscribe: {\n <TSourceValue>(props: {\n source: SubscribeSource<TSourceValue>\n selector?: undefined\n children: ((state: TSourceValue) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSourceValue, TSubSelected>(props: {\n source: SubscribeSource<TSourceValue>\n selector: (state: TSourceValue) => TSubSelected\n children: ((state: TSubSelected) => ReactNode) | ReactNode\n }): ReturnType<FunctionComponent>\n <TSubSelected>(\n props: Omit<SubscribePropsWithStore<TFeatures, TSubSelected>, 'source'>,\n ): ReturnType<FunctionComponent>\n }\n /**\n * A React component that renders headers, cells, or footers with custom markup.\n * Use this utility component instead of manually calling flexRender.\n *\n * @example\n * ```tsx\n * <table.FlexRender cell={cell} />\n * <table.FlexRender header={header} />\n * <table.FlexRender footer={footer} />\n * ```\n *\n * This replaces calling `flexRender` directly like this:\n * ```tsx\n * flexRender(cell.column.columnDef.cell, cell.getContext())\n * flexRender(header.column.columnDef.header, header.getContext())\n * flexRender(footer.column.columnDef.footer, footer.getContext())\n * ```\n */\n FlexRender: <TValue extends CellData = CellData>(\n props: FlexRenderProps<TFeatures, TData, TValue>,\n ) => ReactNode\n /**\n * The selected state of the table. This state may not match the structure of\n * the full table state because it is selected by the selector function that\n * you pass as the 2nd argument to `useTable`.\n *\n * @example\n * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state\n *\n * console.log(table.state.globalFilter)\n */\n readonly state: Readonly<TSelected>\n}\n\n/**\n * Creates a React table instance backed by TanStack Store atoms.\n *\n * The optional selector projects from `table.store`; the selected value is\n * exposed on `table.state` and compared shallowly for React re-renders. Omit\n * the selector to subscribe to every registered table state slice, or pass a\n * narrower selector and use `table.Subscribe` lower in the tree for targeted\n * subscriptions.\n *\n * @example\n * ```tsx\n * const table = useTable(\n * {\n * _features,\n * _rowModels: {},\n * columns,\n * data,\n * },\n * (state) => ({ pagination: state.pagination }),\n * )\n *\n * table.state.pagination\n * ```\n */\nexport function useTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TSelected = TableState<TFeatures>,\n>(\n tableOptions: TableOptions<TFeatures, TData>,\n selector?: (state: TableState<TFeatures>) => TSelected,\n): ReactTable<TFeatures, TData, TSelected> {\n const [table] = useState(() => {\n const tableInstance = constructTable({\n ...tableOptions,\n _features: {\n coreReativityFeature: reactReactivity(),\n ...tableOptions._features,\n },\n }) as unknown as ReactTable<TFeatures, TData, TSelected>\n\n tableInstance.Subscribe = ((props: any) => {\n const source = props.source ?? tableInstance.store\n\n return Subscribe({\n ...props,\n source,\n })\n }) as ReactTable<TFeatures, TData, TSelected>['Subscribe']\n\n tableInstance.FlexRender = FlexRender\n\n return tableInstance\n })\n\n // sync options on every render\n table.setOptions((prev) => ({\n ...prev,\n ...tableOptions,\n }))\n\n const state = useSelector(table.store, selector, { compare: shallow })\n\n // we know this is not the most efficient way to return the table,\n // but it is required for the react compiler to work\n return useMemo(\n () => ({\n ...table,\n options: tableOptions,\n state,\n }),\n [table, tableOptions, state],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6IA,SAAgB,SAKd,cACA,UACyC;CACzC,MAAM,CAAC,SAAS,eAAe;EAC7B,MAAM,gBAAgB,eAAe;GACnC,GAAG;GACH,WAAW;IACT,sBAAsB,gBAAgB;IACtC,GAAG,aAAa;GAClB;EACF,CAAC;EAED,cAAc,cAAc,UAAe;GACzC,MAAM,SAAS,MAAM,UAAU,cAAc;GAE7C,OAAO,UAAU;IACf,GAAG;IACH;GACF,CAAC;EACH;EAEA,cAAc,aAAa;EAE3B,OAAO;CACT,CAAC;CAGD,MAAM,YAAY,UAAU;EAC1B,GAAG;EACH,GAAG;CACL,EAAE;CAEF,MAAM,QAAQ,YAAY,MAAM,OAAO,UAAU,EAAE,SAAS,QAAQ,CAAC;CAIrE,OAAO,eACE;EACL,GAAG;EACH,SAAS;EACT;CACF,IACA;EAAC;EAAO;EAAc;CAAK,CAC7B;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-table",
3
- "version": "9.0.0-alpha.48",
3
+ "version": "9.0.0-alpha.51",
4
4
  "description": "Headless UI for building powerful tables & datagrids for React.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -55,12 +55,12 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@tanstack/react-store": "^0.11.0",
58
- "@tanstack/table-core": "9.0.0-alpha.48"
58
+ "@tanstack/table-core": "9.0.0-alpha.51"
59
59
  },
60
60
  "devDependencies": {
61
- "@eslint-react/eslint-plugin": "^5.7.7",
62
- "@types/react": "^19.2.14",
63
- "@vitejs/plugin-react": "^6.0.1",
61
+ "@eslint-react/eslint-plugin": "^5.8.3",
62
+ "@types/react": "^19.2.15",
63
+ "@vitejs/plugin-react": "^6.0.2",
64
64
  "eslint-plugin-react-compiler": "19.1.0-rc.2",
65
65
  "eslint-plugin-react-hooks": "^7.1.1",
66
66
  "react": "^19.2.6"
@@ -13,7 +13,7 @@ description: >
13
13
  type: lifecycle
14
14
  library: tanstack-table
15
15
  framework: react
16
- library_version: '9.0.0-alpha.47'
16
+ library_version: '9.0.0-alpha.48'
17
17
  requires:
18
18
  - state-management
19
19
  - pagination
@@ -13,7 +13,7 @@ description: >
13
13
  type: composition
14
14
  library: tanstack-table
15
15
  framework: react
16
- library_version: '9.0.0-alpha.47'
16
+ library_version: '9.0.0-alpha.48'
17
17
  requires:
18
18
  - row-selection
19
19
  - column-definitions
@@ -12,7 +12,7 @@ description: >
12
12
  type: composition
13
13
  library: tanstack-table
14
14
  framework: react
15
- library_version: '9.0.0-alpha.47'
15
+ library_version: '9.0.0-alpha.48'
16
16
  requires:
17
17
  - filtering
18
18
  - column-layout
@@ -11,7 +11,7 @@ description: >
11
11
  type: composition
12
12
  library: tanstack-table
13
13
  framework: react
14
- library_version: '9.0.0-alpha.47'
14
+ library_version: '9.0.0-alpha.48'
15
15
  requires:
16
16
  - react/client-to-server
17
17
  - pagination
@@ -14,7 +14,7 @@ description: >
14
14
  type: composition
15
15
  library: tanstack-table
16
16
  framework: react
17
- library_version: '9.0.0-alpha.47'
17
+ library_version: '9.0.0-alpha.48'
18
18
  requires:
19
19
  - react/table-state
20
20
  - state-management
@@ -179,7 +179,7 @@ function Table({ data, filter }) {
179
179
  | `<table.Subscribe>` / `<Subscribe>` | ✓ | Surgical re-render boundaries inside the tree |
180
180
  | `useSelector(table.atoms.X)` | ✓ | Narrowest possible subscription to one slice |
181
181
  | `table.atoms.X.get()` | ✗ current-value read | Inside event handlers / effects |
182
- | `table.store.state` | ✗ current-value read | Debugging / one-shot reads |
182
+ | `table.state` | ✗ current-value read | Debugging / one-shot reads |
183
183
 
184
184
  | Write path | Owner | Effect |
185
185
  | ------------------------------- | ----------------- | ---------------------------------------------------------------------------------- |
@@ -15,7 +15,7 @@ description: >
15
15
  type: composition
16
16
  library: tanstack-table
17
17
  framework: react
18
- library_version: '9.0.0-alpha.47'
18
+ library_version: '9.0.0-alpha.48'
19
19
  requires:
20
20
  - react/table-state
21
21
  - row-expanding
@@ -10,7 +10,7 @@ description: >
10
10
  type: lifecycle
11
11
  library: tanstack-table
12
12
  framework: react
13
- library_version: '9.0.0-alpha.47'
13
+ library_version: '9.0.0-alpha.48'
14
14
  requires:
15
15
  - setup
16
16
  - column-definitions
@@ -6,7 +6,7 @@ description: >
6
6
  memory has a v9 equivalent enumerated below: `useReactTable` → `useTable`,
7
7
  root `get*RowModel` options → `_rowModels` with factory + *Fns parameter,
8
8
  `createColumnHelper<TData>` → `createColumnHelper<typeof _features, TData>`,
9
- `table.getState()` → `table.store.state` / `table.state` / `table.atoms.X.get()`,
9
+ `table.getState()` → `table.state` / `table.store.state` / `table.atoms.X.get()`,
10
10
  `sortingFn` → `sortFn`, `enablePinning` → split, `_`-prefixed APIs unprefixed,
11
11
  `ColumnSizing` split into `columnSizingFeature` + `columnResizingFeature`.
12
12
  For incremental migration, `useLegacyTable` from `@tanstack/react-table/legacy`
@@ -15,7 +15,7 @@ description: >
15
15
  type: lifecycle
16
16
  library: tanstack-table
17
17
  framework: react
18
- library_version: '9.0.0-alpha.47'
18
+ library_version: '9.0.0-alpha.48'
19
19
  requires:
20
20
  - setup
21
21
  - state-management
@@ -120,12 +120,12 @@ const state = table.getState()
120
120
  const cells = row._getAllCellsByColumnId()
121
121
 
122
122
  // v9
123
- const all = table.store.state // flat snapshot
123
+ const all = table.state // flat snapshot
124
124
  const sorting = table.atoms.sorting.get() // per-slice atom
125
125
  const cells = row.getAllCellsByColumnId() // no underscore — APIs unprefixed
126
126
  ```
127
127
 
128
- In components, prefer `<table.Subscribe>` over `table.store.state` for reactivity (see `tanstack-table/react/table-state`).
128
+ In components, prefer `<table.Subscribe>` over `table.state` for reactivity (see `tanstack-table/react/table-state`).
129
129
 
130
130
  ### Renames
131
131
 
@@ -329,7 +329,7 @@ function Toolbar({ table }) {
329
329
  }
330
330
  ```
331
331
 
332
- `getState` was removed. Use `table.store.state` for a flat snapshot, `table.state` if you passed a `useTable` selector, or `<table.Subscribe>` for reactive reads.
332
+ `getState` was removed. Use `table.state` for a flat snapshot, `table.state` if you passed a `useTable` selector, or `<table.Subscribe>` for reactive reads.
333
333
  Source: `docs/framework/react/guide/migrating.md`; `examples/react/basic-subscribe/src/main.tsx`.
334
334
 
335
335
  ### HIGH `enablePinning: true` on v9
@@ -13,7 +13,7 @@ description: >
13
13
  type: lifecycle
14
14
  library: tanstack-table
15
15
  framework: react
16
- library_version: '9.0.0-alpha.47'
16
+ library_version: '9.0.0-alpha.48'
17
17
  requires:
18
18
  - setup
19
19
  - state-management
@@ -269,7 +269,7 @@ function SelectedCount({ table }) {
269
269
  }
270
270
  ```
271
271
 
272
- `<table.Subscribe>` still selects from `table.store.state` (the full state). For a single slice, `useSelector(table.atoms.X)` skips even constructing the snapshot.
272
+ `<table.Subscribe>` still selects from `table.state` (the full state). For a single slice, `useSelector(table.atoms.X)` skips even constructing the snapshot.
273
273
  Source: `docs/framework/react/guide/table-state.md`.
274
274
 
275
275
  ### MEDIUM Hoisting heavy table state reads above virtualizers
@@ -14,7 +14,7 @@ description: >
14
14
  type: framework
15
15
  library: tanstack-table
16
16
  framework: react
17
- library_version: '9.0.0-alpha.47'
17
+ library_version: '9.0.0-alpha.48'
18
18
  requires:
19
19
  - react/table-state
20
20
  sources:
@@ -14,7 +14,7 @@ description: >
14
14
  type: framework
15
15
  library: tanstack-table
16
16
  framework: react
17
- library_version: '9.0.0-alpha.47'
17
+ library_version: '9.0.0-alpha.48'
18
18
  requires:
19
19
  - state-management
20
20
  - setup
@@ -258,7 +258,7 @@ function Pager({ table }) {
258
258
  }
259
259
  ```
260
260
 
261
- `.get()` and `table.store.state` are current-value reads, not subscriptions. The component never re-renders when the atom changes.
261
+ `.get()` and `table.state` are current-value reads, not subscriptions. The component never re-renders when the atom changes.
262
262
  Source: `docs/framework/react/guide/table-state.md`; `examples/react/basic-subscribe/src/main.tsx`.
263
263
 
264
264
  ### HIGH Passing both `atoms.X` and `state.X` for the same slice
@@ -279,7 +279,7 @@ export type LegacyReactTable<TData extends RowData> = ReactTable<
279
279
  > & {
280
280
  /**
281
281
  * Returns the current table state.
282
- * @deprecated In v9, access state directly via `table.state` or use `table.store.state` for the full state.
282
+ * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.
283
283
  */
284
284
  getState: () => TableState<StockFeatures>
285
285
  /**
package/src/useTable.ts CHANGED
@@ -22,7 +22,15 @@ export type ReactTable<
22
22
  TFeatures extends TableFeatures,
23
23
  TData extends RowData,
24
24
  TSelected = TableState<TFeatures>,
25
- > = Table<TFeatures, TData> & {
25
+ > = Omit<Table<TFeatures, TData>, 'store'> & {
26
+ /**
27
+ * @deprecated Prefer `table.state` for render reads,
28
+ * `table.atoms.<slice>.get()` for slice snapshots, or
29
+ * `table.Subscribe` / `useSelector(table.store, selector)` for explicit
30
+ * subscriptions. `table.store.state` is a current-value snapshot and is easy
31
+ * to misuse in render code.
32
+ */
33
+ readonly store: Table<TFeatures, TData>['store']
26
34
  /**
27
35
  * A React HOC (Higher Order Component) that allows you to subscribe to the table state.
28
36
  *
@@ -95,7 +103,9 @@ export type ReactTable<
95
103
  props: FlexRenderProps<TFeatures, TData, TValue>,
96
104
  ) => ReactNode
97
105
  /**
98
- * The selected state of the table. This state may not match the structure of `table.store.state` because it is selected by the `selector` function that you pass as the 2nd argument to `useTable`.
106
+ * The selected state of the table. This state may not match the structure of
107
+ * the full table state because it is selected by the selector function that
108
+ * you pass as the 2nd argument to `useTable`.
99
109
  *
100
110
  * @example
101
111
  * const table = useTable(options, (state) => ({ globalFilter: state.globalFilter })) // only globalFilter is part of the selected state
@@ -144,7 +154,7 @@ export function useTable<
144
154
  coreReativityFeature: reactReactivity(),
145
155
  ...tableOptions._features,
146
156
  },
147
- }) as ReactTable<TFeatures, TData, TSelected>
157
+ }) as unknown as ReactTable<TFeatures, TData, TSelected>
148
158
 
149
159
  tableInstance.Subscribe = ((props: any) => {
150
160
  const source = props.source ?? tableInstance.store