@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.
@@ -1697,7 +1697,7 @@ const Pagination = {
1697
1697
  setPageIndex: updater => {
1698
1698
  instance.setPagination(old => {
1699
1699
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1700
- const maxPageIndex = typeof old.pageCount !== 'undefined' ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1700
+ const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1701
1701
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1702
1702
  return { ...old,
1703
1703
  pageIndex
@@ -1726,9 +1726,9 @@ const Pagination = {
1726
1726
  });
1727
1727
  },
1728
1728
  setPageCount: updater => instance.setPagination(old => {
1729
- var _old$pageCount;
1729
+ var _instance$options$pag;
1730
1730
 
1731
- let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1731
+ let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1732
1732
 
1733
1733
  if (typeof newPageCount === 'number') {
1734
1734
  newPageCount = Math.max(-1, newPageCount);
@@ -1738,7 +1738,7 @@ const Pagination = {
1738
1738
  pageCount: newPageCount
1739
1739
  };
1740
1740
  }),
1741
- getPageOptions: memo(() => [instance.getState().pagination.pageSize, instance.getState().pagination.pageCount], (pageSize, pageCount) => {
1741
+ getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1742
1742
  let pageOptions = [];
1743
1743
 
1744
1744
  if (pageCount && pageCount > 0) {
@@ -1792,15 +1792,9 @@ const Pagination = {
1792
1792
  return instance._getPaginationRowModel();
1793
1793
  },
1794
1794
  getPageCount: () => {
1795
- const {
1796
- pageCount
1797
- } = instance.getState().pagination;
1798
-
1799
- if (typeof pageCount !== 'undefined') {
1800
- return pageCount;
1801
- }
1795
+ var _instance$options$pag2;
1802
1796
 
1803
- return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1797
+ return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1804
1798
  }
1805
1799
  };
1806
1800
  }