mirror of
https://github.com/gosticks/react-table.git
synced 2025-10-16 11:55:36 +00:00
Fix possible empty page options
This commit is contained in:
parent
42b41d1260
commit
6482869e8a
@ -5,7 +5,7 @@ import { useTable } from '../../hooks/useTable'
|
||||
import { usePagination } from '../usePagination'
|
||||
import { useFilters } from '../useFilters'
|
||||
|
||||
const data = [...new Array(1000)].map((d, i) => ({
|
||||
const data = [...new Array(1000)].fill(null).map((d, i) => ({
|
||||
firstName: `tanner ${i + 1}`,
|
||||
lastName: 'linsley',
|
||||
age: 29,
|
||||
|
||||
@ -117,7 +117,10 @@ function useInstance(instance) {
|
||||
: Math.ceil(rows.length / pageSize)
|
||||
|
||||
const pageOptions = React.useMemo(
|
||||
() => (pageCount > 0 ? [...new Array(pageCount)].map((d, i) => i) : []),
|
||||
() =>
|
||||
pageCount > 0
|
||||
? [...new Array(pageCount)].fill(null).map((d, i) => i)
|
||||
: [],
|
||||
[pageCount]
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user