MCPcopy
hub / github.com/TanStack/table / createSolidTable

Function createSolidTable

packages/solid-table/src/index.tsx:27–65  ·  view source on GitHub ↗
(
  options: TableOptions<TData>
)

Source from the content-addressed store, hash-verified

25}
26
27export function createSolidTable<TData extends RowData>(
28 options: TableOptions<TData>
29) {
30 const resolvedOptions: TableOptionsResolved<TData> = mergeProps(
31 {
32 state: {}, // Dummy state
33 onStateChange: () => {}, // noop
34 renderFallbackValue: null,
35 mergeOptions: (
36 defaultOptions: TableOptions<TData>,
37 options: Partial<TableOptions<TData>>
38 ) => {
39 return mergeProps(defaultOptions, options) as TableOptions<TData>
40 },
41 },
42 options
43 )
44
45 const table = createTable<TData>(resolvedOptions)
46 const [state, setState] = createStore(table.initialState)
47
48 createComputed(() => {
49 table.setOptions(prev => {
50 return mergeProps(prev, options, {
51 state: mergeProps(state, options.state || {}),
52 // Similarly, we'll maintain both our internal state and any user-provided
53 // state.
54 onStateChange: (updater: any) => {
55 // merging isn't required because stores shallow update
56 setState(updater)
57
58 options.onStateChange?.(updater)
59 },
60 })
61 })
62 })
63
64 return table
65}

Callers 7

AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90
AppFunction · 0.90

Calls 1

createTableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…