@bendyline/squisq-react 2.12.21 → 2.12.22

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.
@@ -59,6 +59,8 @@ function PaginatedDocView({
59
59
  const [currentPage, setCurrentPage] = useState(
60
60
  () => Math.min(Math.max(0, initialPage), lastPage)
61
61
  );
62
+ const currentPageRef = useRef(currentPage);
63
+ currentPageRef.current = currentPage;
62
64
  const scrollRef = useRef(null);
63
65
  const pendingPageRef = useRef(null);
64
66
  const pendingPageTimeoutRef = useRef(null);
@@ -102,7 +104,7 @@ function PaginatedDocView({
102
104
  if (!container) return;
103
105
  const keys = JSON.parse(pageKeys);
104
106
  const previous = previousLayoutRef.current;
105
- const selected = pendingPageRef.current ?? currentPage;
107
+ const selected = pendingPageRef.current ?? currentPageRef.current;
106
108
  const preserveSelection = previous && previous.initialPage === initialPage && (selected > 0 || pendingPageRef.current !== null);
107
109
  const retained = preserveSelection ? keys.indexOf(previous.keys[selected]) : -1;
108
110
  const requested = preserveSelection ? retained >= 0 ? retained : selected : initialPage;
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-2DUF6C7B.js";
21
21
  import {
22
22
  PaginatedDocView
23
- } from "./chunk-MUYICTDA.js";
23
+ } from "./chunk-MIJNUVEL.js";
24
24
  import {
25
25
  CanvasSection,
26
26
  LinearDocView,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PaginatedDocView
3
- } from "../chunk-MUYICTDA.js";
3
+ } from "../chunk-MIJNUVEL.js";
4
4
  import {
5
5
  CanvasSection,
6
6
  LinearDocView,