- Added semantic release support. So no more changelog entries here! See ya!
- Fixed a regression where @scarf/scarf was somehow removed from the package dependencies
- Fixed an issue where unnecessary documentation dependencies were added when installing the library
- Fixed an issue where the
scripts
directory was not added to the npm package on build
- Fixed an issue where the internal flexRenderer would not work correctly in production due to the strangest friggin' minification bug I've ever encountered. 🤷♂️
- Added the
value
property to cell renderers so that destructurin the value from thecell
property is now not necessary. This should help with people migrating from v6 and also just to cut down on noise in cell renderers - Fixed an issue where rollup would not build correctly
- Fixed an issue where a page index of
-1
would result in an error
- Fixed an issue where page options array could be empty
- Fixed an issue where duplicate columns would be silently deduped. There is now a warning when duplicate columns are found based on their IDs
- Moved some functions around so they will get treeshaked with their respective plugins that use them.
- Fixed an issue where filters, sorting, or grouping changes would not reset pagination
- Added table and column level options for disabling global filters
- Fixed an issue where row selection was not deselecting rows
- Fixed an issue where flex table rendering was not giving the table a minimum width with necessary
- Fixed an issue where row selection would not work when using other row-transformative plugins like filters or grouping
- Fixed an issue where header groups were not memoized correctly
- Moved away from snapshot tests. No more testing implementation details.
- Added
visibleColumns
andvisibleColumnsDeps
hooks to manipulate columns after all data is processed. Further visibility processing may result in these columns not being visible, such ashiddenColumn
state - The
useRows
hook has been deprecated due to its dangerous nature 💀 - Added the
instance.rowsById
object - Renamed
instance.flatColumns
toinstance.allColumns
which now accumulates ALL columns created for the table, visible or not. - Added the
instance.visibleColumns
object - Fix an issue where
useAsyncDebounce
would crash when passed arguments - Started development on the
usePivotColumns
plugin, which can be tested currently using the_UNSTABLE_usePivotColumns
export. - Renamed
cell.isRepeatedValue
tocell.isPlaceholder
- Removed
useConsumeHookGetter
as it was inefficient most of the time and noisy - All hooks are now "consumed" right after main plugin functions are run. This means that any attempt to add a plugin after that will result in a runtime error (for good reason, since using hook points should not be a conditional or async operation)
- Added
instance.getHooks
for getting the list of hooks that was captured after plugins are run - Normalized all "toggle" actions to use an optional
value
property to set the value instead of toggle. Previously properties likeselected
,groupBy
, etc. were used, but not any more! - Undocument
instance.dispatch
. Both plugins and users should be interacting with the table via methods assigned to the instance and other structures on the table. This should both reduce the surface API that React Table needs to expose and also the amount of documentation that is needed to understand how to use the API. useRowState
'sinitialRowStateAccessor
andinitialCellStateAccessor
options now have a default ofrow => ({})
andcell => ({})
respectively.- Removed the concept of complex aggregations (eg.
column.aggregate = ['sum', 'count']
). Instead, a better aggregation function signature is now used to allow for leaf node aggregation when needed. - Added the
column.aggregateValue
option which allows resolving (or pre-aggregating) a cell's value before it is grouped and aggregated across rows. This is useful for cell values that are not primitive, eg. an array of values that you may want to unique and count before summing that count across your groupings - The function signature for aggregation functions has changed to be
(leafValues, aggregatedValues) => aggregatedValue
whereleafValues
is a flat array containing all leaf rows currently grouped at the aggregation level andaggregatedValues
is an array containing the aggregated values from the immediate child sub rows. Each has purpose in the types of aggregations they power where optimizations are made for either accuracy or performance. - Fixed an issue where
setGlobalFilter
was not a stable callback - Added a Bootstrap UI example
- Added fixed with column support for useFlexLayout
- Fixed an issue where
manualGlobalFilter
was not resetting pagination properly - Fixed an issue where
useGlobalFilter
could be placed afterusePagination
- Added the sort order direction as a parameter to the sortMethod function
- Fixed an issue where user filter types were not being referenced correctly
- Renamed the
row.getExpandedToggleProps
torow.getToggleRowExpandedProps
- Renamed the
row.toggleExpanded
method torow.toggleRowExpanded
- Added the
instance.toggleRowExpanded
andinstance.toggleAllRowsExpanded
methods - Added the
instance.getToggleAllRowsExpandedProps
prop getter - Added the
instance.filteredRowsById
property - Added the
instance.preFilteredRowsById
property - useFilters now properly updates the
instance.rowsById
property - Added the
instance.globalFilteredRowsById
property - Added the
instance.preGlobalFilteredRowsById
property - useGlobalFilter now properly updates the
instance.rowsById
property - Added the
instance.nonGroupedFlatRows
property - Added the
instance.nonGroupedRowsById
property - Added the
instance.onlyGroupedFlatRows
property - Added the
instance.onlyGroupedRowsById
property - Improved the api around ensuring plugin ordering
- Added more plugin order rules to avoid strange plugin integration results
- Added
useGlobalFilter
hook for performing table-wide filtering - Filter function signature has changed to supply an array of column IDs (to support both the tranditional single column style and the new multi-column search style introduced with
useGlobalFilter
). - Removed the
column
parameter from the filter function signature as it was unused and no longer made sense with the array of IDs change above. - Updated the
filtering
example to use a global filter in addition to the column filters
- Changed the function signature for all propGetter hooks to accept a single object of named meta properties instead of a variable length of meta arguments. The user props object has also been added as a property to all prop getters. For example,
hooks.getRowProps.push((props, instance, row) => [...])
is now writtenhooks.getRowProps.push((props, { instance, row, userProps }) => [...])
- Changed the function signature for all reduceHooks accept a single object of named meta properties instead of a variable length of meta arguments. For example,
hooks.flatColumns.push((flatColumns, instance) => flatColumns)
is now writtenhooks.flatColumns.push((flatColumns, { instance }) => flatColumns)
- Changed the function signature for all loopHooks accept a single object of named meta properties instead of a variable length of meta arguments. For example,
hooks.prepareRow.push((row, instance) => void)
is now writtenhooks.prepareRow.push((row, { instance }) => void)
- Added the
useControlledState
hook for plugins to manipulate the final state of the table similar to how users can - Fixed an issue where column hiding wasn't working properly.
- Fixed an issue where removing a grouped column would result in a crash
- Fixed an issue where plugins using the
columns
hook were not getting decorated properly - Added back a new rendition of the
useFlexLayout
plugin and accompanying example. - Fixed all reset actions to use the initial state passed into the table, then fall back to the default initial state for the hook
- Optimizations made to make accessors, prop getters and other internals much faster. 10x in some cases!
- Fixed docs for
usePagination
to havepageIndex
andpageSize
only available on the state object, not the instance - Added a plugin order restriction to make sure
useResizeColumns
always comes beforeuseAbsoluteLayout
- Fixed the
useFinalInstance
hook to not have an empty array as the first meta argument passed. - Fixed an issue where memoized or ref-forwarded components could not be used as cell renderers
- The
toggleExpandedById
action has been renamed totoggleExpanded
- Added the
toggleAllExpanded
action - Added the
setExpanded
action - Changed
row.isAggregated
torow.isGrouped
state.expanded
andstate.selectedRowIds
are now objects ({[rowId]: Bool}
), not arrays. This should help with mid-to-large size datasets while also being serializable (instead of a Set(), which is not as reliable)state.filters
is now an array of objects ({id, value}
). Since filters do have order and can be applied incrementally, it should be an array to ensure correct order.- Moved the
flatColumns
andflatColumnsDeps
hooks to be after row/data materialization. These hooks can then manipulate theflatColumns
object after all data has been accessed without triggering row materialization again. - Added the
row.allCells
property and thecellColumns
reducer hook to determine which cells to create for each row. These cells are placed intorow.allCells
. The resulting cell array is not meant to be used for display in templating and is only made available for convenience and/or advanced templating. - Added the
cells
reducer hook to determine which cells from therow.allCells
array that should be placed intorow.cells
. The resulting cell array is the one that is intended for display in templating. - Reducers are now passed the actual instance variable, not the instanceRef
- Added the
makeRenderer
utility (also exported) - Removed
column.groupByBoundary
functionality. If needed, use theflatColumns
hook to decorate, reorganize or re-order groupBy columns - Fixed grouped row.id's to be truly unique
- Fixed an issue where dependency hooks were not being reduced properly, thus the table would rerender unnecessarily
- Renamed
toggleRowSelectedAll
totoggleAllRowsSelected
. Duh... - Added an
indeterminate
boolean prop to the default props for row selection toggle prop getters - Renamed
selectedRowPaths
toselectedRowIds
, which also no longer contains paths, but row IDs - Grouped or nested row selection actions and state are now derived, instead of tracked in state.
- Rows now have a new property called
id
, which existed before and was derived from thegetRowId
option - Rows now also have an
isSomeSelected
prop when using theuseRowSelect
hook, which denotes that at least one subRow is selected (if applicable) - Rows'
path
property has been deprecated in favor ofid
- Expanded state is now tracked with row IDs instead of paths
- RowState is now tracked with row IDs instead of paths
toggleExpandedByPath
has been renamed totoggleExpandedById
, and thus accepts a row ID now, instead of a row path
- Fix an issue where
useResizeColumns
would crash when using the resizer prop getter - Fix an issue where
useBlockLayout
was clobbering props sent to headers
Removed:
applyHooks
(exported but undocumented) function has been deprecated. Please use eitherreduceHooks
orloopHooks
utilities in your custom plugins now.applyPropHooks
(exported but undocumented) function has been deprecated. Please use themakePropGetter
utility in your custom plugins now.
Added:
reduceHooks
exported utility which is used to reduce a value through a collection of hooks. Each hook must return a value (mutation is discouraged)loopHooks
exported utility which is used to loop over a collection of hooks. Hooks are not allowed to return a value (mutation is encouraged)makePropGetter
exported utility which is used to create prop getters from a prop getter hook.useOptions
plugin hook, which allows a plugin to reduce/modify the initial options being passed to the tableuseFinalInstance
plugin hook, which allows a plugin access to the final table instance before it is returned to the user.
Modified:
- Prop-getter hook functions now support returning an array (in addition to the typical object of props). When an array is returned, each item in the array is smart-merged into a new props object (meaning it will intelligently compose and override styles and className)
- Prop-getter function supplied to the table have 2 new overloaded options (in addition to the typical object of props):
Function(props, instance, ...row/col/context) => Array<props> | props
- If a function is passed to a prop getter function, it will receive the previous props, the table instance, and potentially more context arguments. It is then be expected to return either an array of new props (to be smart-merged with styles and classes, the latest values taking priority over the previous values) or a props object (which will replace all previous props)Array<props>
- If an array is passed to a prop getter function, each prop object in the array will be smart-merged with styles and classes into the props from previous hooks (with the latest values taking priority over the previous values).
- Extracted default hooks into separate file.
- Converted almost all usages of
instanceRef.current
to useuseGetLatest(instanceRef.current)
to help with avoiding memory leaks and to be more terse. - Converted all previous prop-getter definitions to use the new
makePropGetter
- Reorganized plugin hooks to declare as many hooks in the main plugin function as opposed to in the
useInstance
hook. - Changed the
useInstanceBeforeDimensions
hook to be aloopHooks
call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance) - Changed the
useInstance
hook to be aloopHooks
call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance) - Change the
prepareRow
hook to be aloopHooks
call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the row)
- The
columnsBeforeHeaderGroups
andcolumnsBeforeHeaderGroupsDeps
hooks have been renamed toflatColumns
andflatColumnsDeps
respectively, which better reflects what they are used for, rather than their order, which can remain implicit. - Added
headerGroups
andheaderGroupDeps
hooks, which, similar toflatColumns
, allow you to decorate (and trigger) the memoized header group generation. - Added
columns
andcolumnsDeps
hooks, which, similar toflatColumns
andheaderGroups
, allow you to decorate (and trigger) the memoized column generation/decoration. - The new hook order is as follows:
columns/columnsDeps
=>flatColumns/flatColumnsDeps
=>headerGroups/headerGroupsDeps
useColumnVisibility
now uses the newheaderGroupsDeps
hook to trigger header group regeneration when visibility changes
- Fixed an issue where the exported
useAsyncDebounce
method would crash if its promise throw an error.
- A maintenance release, purely intended to update the @latest tag (which was overwritten by a v6 publish)
- Fixed an issue where
column.clearSortBy
would crash
reducerHandlers
has been deprecated in favor of the newstateReducers
hook.- The
previousState
andinstanceRef
are now both generally available in state reducers for convenience. - The global action property
action.instanceRef
has been deprecated.
- The
- The
reducer
option has been renamed tostateReducer
and in addition to passing a single reducer function now also supports passing an array of reducers - Renamed
manualSorting
to bemanualSortBy
to be consistent with other naming conventions - Removed the
getResetPageDeps
option in favor of the newautoResetPage
option. - Removed the
getResetFilterDeps
option in favor of the newautoResetFilters
option. - Removed the
getResetSortByDeps
option in favor of the newautoResetSortBy
option. - Removed the
getResetGroupByDeps
option in favor of the newautoResetGroupBy
option. - Removed the
getResetExpandedDeps
option in favor of the newautoResetExpanded
option. - Added a new exported utility called
useAsyncDebounce
to aid with external async side-effects. - A new
useGetLatest
hook is used internally to track latest instances in a less ref-driven and verbose way. - A new
useMountedLayoutEffect
hooks is now used internally to handle post-mount side-effects, mostly dealing with autoReset functionality - Plugin hooks are now "consumed" using an internal
useConsumeHookGetter
hook. When they are consumed, they can no longer be manipulated past that point in the table lifecycle. This should help ensure people are using them in a relatively safe order with consistent expectations. - Drastically "reduced" the reducer logic itself to be easier to understand and to be a stable reference for the life of the table. This change also means that the reducer must no longer be double-run/back-compared by React for changes in closure, thus actions and stateReducers (including user state reducers) will only fire once per action.
- Removed
debug
and related logging. It has been somewhat useful during development, but is now very noisy in the code. We can debug lifecycle and performance as needed from here on out. - Removed unnecessary exports from
./utils.js
and moved all intentionally exported utilities to a new./publicUtils.js
file.
- Minor regex optimizations during row path creation
- Added the support for the
Footer
renderer,column.getFooterProps
,footerGroups
andfooterGroup.getFooterProps
- Added the
useColumnVisibility
plugin as a core plugin along with several new instance and column-level methods to control column visibility - Added the "column-hiding" example
- Added the
useControlledState
option, which allows for hook-context control of the resolved internal table state
- Fixed an issue where the table would crash if useSortBy was reset via the resetSortBy action
- Updated all of the examples to use the "react-table@latest" tag.
utils
is no longer an exported variable and instead, all of the individual util methods are exported at the root level of the library.
- Fixed an issue where
useRowState
would crash due to invalid initial state of previous cell state oncolumnId
lookup
- Changed
selectedRowIds
to use aSet()
instead of an array for performance. - Removed types and related files from the repo. The community will now maintain types externally on Definitely Typed
- The internal
useMain
hook has been renamed touseInstance
- The internal
useBeforeDimensions
hook has been renamed touseInstanceBeforeDimensions
- Fixed an issue where
useResizeColumns
wasn't working properly
- Fixed an issue where
useRowState
would crash due to invalid initial state attempting to spread into the new state
- Removed deprecated
defaultState
export
- Internals have been reworked to use
useReducer
instead ofuseState
for stability and architecture - The
state
option has been removed in favor of using a custom reducer - The
reducer
option has been changed to a new function signature:function (newState, action, oldState) => newState
- The
setState
table instance method is no longer supported - The
dispatch
table instanced method was added - The
ReactTable.actions
export is now a plain object of action types mapped to identically named action strings - The
ReactTable.reducerHandlers
export was added, which is a plain object of plugin hook names mapped to their respective reducer functions
- Added an
isAggregated
boolean parameter to theaggregate
function signature
- Removed service workers from examples
- Fixed a memory leak when
instance
was referenced in function closures - Fixed an issue where the table would infinitely rerender due to incorrect effect dependencies
- Fixed an issue where row grouping and row selection would not work properly together.
- Fixed an issue where
defaultGetResetPageDeps
was usingdata
instead ofrows
- Removed
disablePageResetOnDataChange
option. use thegetResetPageDeps
option now.
- Added
getResetPageDeps
optiongetResetFilterDeps
optiongetResetSortByDeps
optiongetResetGroupByDeps
optiongetResetExpandedDeps
option
- Added options
defaultCanSort
defaultCanFilter
defaultCanGroupBy
column.defaultCanSort
column.defaultCanFilter
column.defaultCanGroupBy
- Renamed
disableGrouping
todisableGroupBy
disableSorting
todisableSortBy
disableGroupBy
todisableGroupBy
column.disableGrouping
tocolumn.disableGroupBy
column.disableSorting
tocolumn.disableSortBy
column.disableGroupBy
tocolumn.disableGroupBy
- Removed propType definitions. Since types are now being maintained, it makes little sense to also maintain these. Cooincidentally, this also saves some bundle size in some scenarios where they may not be removed properly by a developer's bundler.
- Massive changes to the entire project and library. Please consult the README and documentation for more information regarding these changes.
- Since
resolveData
is now capable of materializing data on it's own, thedata
prop is no longer required as a prop-type.
- Only run
resolveData
prop whendata
prop has changed, not any others.
- Allow the
resolveData
prop to alter or materialize new data when thedata
prop changes.
- Updated eslint and code formatting
- Now passes
column
togetResizerProps
(#667) - NOTE:
getResizerProps
is now only called if the column is resizable - Fixes the
className
ordering in defaultProps for ThComponent (#673) - NOTE: user supplied classNames now come at the end so they can extend the defaults
- Fix Prop types for columns
- Fix the rest of the proptypes
getPropTypes
proptype check
eslint-config
moved to dev deps
- Expose page/pageSize to rows/cells
- Supply sort direction to custom sort methods
- README updates
- Linter cleanup
- Added PropTypes node module
- Deps, linting and style upgrades
- moved repo to react-tools
- Doc examples moved to codesandbox.io
- README updates
- CSS refacting for rt-tfoot to match rt-thead
- CSS more specific for input and select
onClick
proxying and eslint
- Provide onClick handleOriginal function - #406
- README updates
makePathArray
in utils - #326- Various fixes: #294, #376, #398, #415,
defaultExpanded
now works correctly - #372column.getProps().rest
props are now applied correctlymakeTemplateComponent
now supportsdisplayName
- #289
column.filterAll
- defaults tofalse
, but when set totrue
will provide the entire array of rows tofilterMethod
as opposed to one row at a time. This allows for more fine-grained filtering using any method you can dream up. See the Custom Filtering example for more info.
PadRowComponent
- the content rendered inside of a padding row. Defaults to a react component that renders
defaultSortDesc
- allows you to set the default sorting direction for all columns to descending.column.defaultSortDesc
- allows you to set the default sorting direction for a specific column. Falls back to the globaldefaultSortDesc
when not set at all.
- New Renderers:
Aggregated
- Custom renderer for aggregated cellsPivot
- Custom renderer for Pivoted Cells (utilizesExpander
andPivotValue
)PivotValue
- Custom renderer for Pivot cell values (deprecates the undocumentedpivotRender
option)Expander
- Custom renderer for Pivot cell Expander
- Added custom sorting methods per table via
defaultSortMethod
and per column viacolumn.sortMethod
- Pivot columns are now visibly separate and sorted/filtered independently.
- Added
column.resizable
to override global tableresizable
option for specific columns. - Added
column.sortable
to override global tablesortable
option for specific columns. - Added
column.filterable
to override global tablefilterable
option for specific columns. - Added
defaultExpanded
table option. - All callbacks can now be utilized without needing to hoist and manage the piece of state they export. That is what their prop counterparts are for, so now the corresponding prop is used instead of the callback to detect a "fully controlled" state.
- Prevent transitions while column resizing for a smoother resize effect.
- Disable text selection while resizing columns.
- New Renderers:
Cell
- deprecates and replacesrender
Header
- deprecates and replacesheader
Footer
- deprecates and replacesfooter
Filter
- deprecates and replacesfilterRender
- Callbacks now provide the destination state as the primary parameter(s). This makes hoisting and controlling the state in redux or component state much easier. eg.
onSorting
no longer requires you to build your own toggle logiconResize
no longer requires you to build your own resize logic
- Renamed
onChange
callback ->onFetchData
which will always fire when a new data model needs to be fetched (or if not usingmanual
, when new data is materialized internally). - Renamed
filtering
->filtered
- Renamed
sorting
->sorted
- Renamed
expandedRows
->expanded
- Renamed
resizing
->resized
- Renamed
defaultResizing
->defaultResized
- Renamed
defaultFiltering
->defaultFiltered
- Renamed
defaultSorting
->defaultSorted
- Renamed
onSortingChange
->onSortedChange
- Renamed
onFilteringChange
->onFilteredChange
- Renamed
onResize
->onResizedChange
- Renamed
onExpandRow
->onExpandedChange
- Renamed
showFilters
->filterable
- Renamed
hideFilter
->filterable
(Column option. Note the true/false value is now flipped.) cellInfo.row
androwInfo.row
now reference the materialize data for the table. To reference the original row, usecellInfo.original
androwInfo.original
- Removed
pivotRender
column option. You can now control how the value is displayed by overriding thePivotValueComponent
or the individual column'sPivotValue
renderer. See Pivoting Options Story for a reference on how to customize pivot column rendering.