Compare commits

...
Author SHA1 Message Date
Tanner Linsley ee8b9fd92c v7.0.0-beta.15 2019-11-25 12:27:09 -07:00
Andros Rosa LlopandTanner Linsley e924b80709 Fix types of getRowID & getSubRows (#1651)
Closes: https://github.com/tannerlinsley/react-table/issues/1628
2019-11-25 12:25:09 -07:00
Andros Rosa LlopandTanner Linsley 2ecdfbd24e [Fix] defaultGetResetPageDeps should listen to data, not rows (#1658)
Related to: https://github.com/tannerlinsley/react-table/issues/1657

Discussion: https://spectrum.chat/react-table/general/v7-maximum-update-depth-exceeded-usegroupby-useexpanded-with-usepagination~2c25e2b8-7a61-4c32-84b3-87db458701c2

Thanks to @iamjon for identifying usePagination was the culprit.
I then checked the last changes made to it, and noticed it was previously listening to data and now it listened to rows (which I believe is a new reference on each render), causing infinite loop on one of its effects.

I tested this change on my project and everything seems ok now.
2019-11-25 12:24:20 -07:00
Andros Rosa LlopandTanner Linsley 461aa0df96 Types: getGroupByToggleProps was lost (#1654)
* There it was, on an unused UseGroupByHeaderProps interface, while it should have been on UseGroupByColumnProps.
2019-11-22 19:31:14 -07:00
3 changed files with 5 additions and 9 deletions
Vendored
+2 -6
View File
@@ -60,8 +60,8 @@ export type UseTableOptions<D extends object> = {
) => TableState<D>
defaultColumn: Partial<Column<D>>
initialRowStateKey: IdType<D>
getSubRows: (row: Row<D>, relativeIndex: number) => Array<Row<D>>
getRowID: (row: Row<D>, relativeIndex: number) => string
getSubRows: (originalRow: D, relativeIndex: number) => Array<D>
getRowID: (originalRow: D, relativeIndex: number) => IdType<D>
debug: boolean
}>
@@ -210,7 +210,6 @@ export namespace useExpanded {
}
export type UseExpandedOptions<D extends object> = Partial<{
getSubRows: (row: Row<D>, relativeIndex: number) => Array<Row<D>>
manualExpandedKey: IdType<D>
paginateExpandedRows: boolean
getResetExpandedDeps: (i: TableInstance) => Array<any>
@@ -356,9 +355,6 @@ export interface UseGroupByColumnProps<D extends object> {
isGrouped: boolean
groupedIndex: number
toggleGroupBy: () => void
}
export interface UseGroupByHeaderProps<D extends object> {
getGroupByToggleProps: (props?: object) => object
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "react-table",
"version": "7.0.0-beta.14",
"version": "7.0.0-beta.15",
"description": "A fast, lightweight, opinionated table and datagrid built on React",
"license": "MIT",
"homepage": "https://github.com/tannerlinsley/react-table#readme",
+2 -2
View File
@@ -17,10 +17,10 @@ export const usePagination = hooks => {
usePagination.pluginName = 'usePagination'
const defaultGetResetPageDeps = ({
rows,
data,
manualPagination,
state: { filters, groupBy, sortBy },
}) => [manualPagination ? null : rows, filters, groupBy, sortBy]
}) => [manualPagination ? null : data, filters, groupBy, sortBy]
function useMain(instance) {
const {