@tanstack/react-table 8.0.0-beta.7 → 8.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1699,7 +1699,7 @@ const Pagination = {
1699
1699
  setPageIndex: updater => {
1700
1700
  instance.setPagination(old => {
1701
1701
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1702
- const maxPageIndex = typeof old.pageCount !== 'undefined' ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1702
+ const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1703
1703
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1704
1704
  return { ...old,
1705
1705
  pageIndex
@@ -1728,9 +1728,9 @@ const Pagination = {
1728
1728
  });
1729
1729
  },
1730
1730
  setPageCount: updater => instance.setPagination(old => {
1731
- var _old$pageCount;
1731
+ var _instance$options$pag;
1732
1732
 
1733
- let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1733
+ let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1734
1734
 
1735
1735
  if (typeof newPageCount === 'number') {
1736
1736
  newPageCount = Math.max(-1, newPageCount);
@@ -1740,7 +1740,7 @@ const Pagination = {
1740
1740
  pageCount: newPageCount
1741
1741
  };
1742
1742
  }),
1743
- getPageOptions: memo(() => [instance.getState().pagination.pageSize, instance.getState().pagination.pageCount], (pageSize, pageCount) => {
1743
+ getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1744
1744
  let pageOptions = [];
1745
1745
 
1746
1746
  if (pageCount && pageCount > 0) {
@@ -1794,15 +1794,9 @@ const Pagination = {
1794
1794
  return instance._getPaginationRowModel();
1795
1795
  },
1796
1796
  getPageCount: () => {
1797
- const {
1798
- pageCount
1799
- } = instance.getState().pagination;
1800
-
1801
- if (typeof pageCount !== 'undefined') {
1802
- return pageCount;
1803
- }
1797
+ var _instance$options$pag2;
1804
1798
 
1805
- return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1799
+ return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1806
1800
  }
1807
1801
  };
1808
1802
  }