()
| 70 | ` |
| 71 | |
| 72 | export const App = () => { |
| 73 | const rerender = React.useReducer(() => ({}), {})[1] |
| 74 | |
| 75 | const [data, setData] = React.useState(makeData(1000)) |
| 76 | const refreshData = () => setData(makeData(1000)) |
| 77 | |
| 78 | const [columnVisibility, setColumnVisibility] = React.useState({}) |
| 79 | const [grouping, setGrouping] = React.useState<GroupingState>([]) |
| 80 | const [isSplit, setIsSplit] = React.useState(false) |
| 81 | const [rowSelection, setRowSelection] = React.useState({}) |
| 82 | const [columnPinning, setColumnPinning] = React.useState({}) |
| 83 | const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>( |
| 84 | [] |
| 85 | ) |
| 86 | const [globalFilter, setGlobalFilter] = React.useState('') |
| 87 | |
| 88 | const [autoResetPageIndex, skipAutoResetPageIndex] = useSkipper() |
| 89 | |
| 90 | const table = useReactTable({ |
| 91 | data, |
| 92 | columns, |
| 93 | defaultColumn, |
| 94 | getCoreRowModel: getCoreRowModel(), |
| 95 | getFilteredRowModel: getFilteredRowModel(), |
| 96 | getPaginationRowModel: getPaginationRowModel(), |
| 97 | getSortedRowModel: getSortedRowModel(), |
| 98 | getGroupedRowModel: getGroupedRowModel(), |
| 99 | getFacetedRowModel: getFacetedRowModel(), |
| 100 | getFacetedUniqueValues: getFacetedUniqueValues(), |
| 101 | getFacetedMinMaxValues: getFacetedMinMaxValues(), |
| 102 | onColumnFiltersChange: setColumnFilters, |
| 103 | onGlobalFilterChange: setGlobalFilter, |
| 104 | globalFilterFn: fuzzyFilter, |
| 105 | autoResetPageIndex, |
| 106 | enableColumnResizing: true, |
| 107 | columnResizeMode: 'onChange', |
| 108 | onColumnVisibilityChange: setColumnVisibility, |
| 109 | onGroupingChange: setGrouping, |
| 110 | onColumnPinningChange: setColumnPinning, |
| 111 | onRowSelectionChange: setRowSelection, |
| 112 | // Provide our updateData function to our table meta |
| 113 | meta: getTableMeta(setData, skipAutoResetPageIndex), |
| 114 | state: { |
| 115 | grouping, |
| 116 | columnFilters, |
| 117 | globalFilter, |
| 118 | columnVisibility, |
| 119 | columnPinning, |
| 120 | rowSelection, |
| 121 | }, |
| 122 | debugTable: true, |
| 123 | debugHeaders: true, |
| 124 | debugColumns: true, |
| 125 | }) |
| 126 | |
| 127 | React.useEffect(() => { |
| 128 | if (table.getState().columnFilters[0]?.id === 'fullName') { |
| 129 | if (table.getState().sorting[0]?.id !== 'fullName') { |
nothing calls this directly
no test coverage detected