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