@jsenv/navi 0.29.496 → 0.29.497

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.
@@ -86715,19 +86715,28 @@ const useListScrollSync = ({
86715
86715
  });
86716
86716
  }, []);
86717
86717
  // What to do when the list's own geometry moves under it, kept fresh for the
86718
- // observer below (which is installed once).
86718
+ // observer below (which is installed once). A held list is placed inside the
86719
+ // resize delivery, so the browser paints it where it lands; answers whether
86720
+ // it was.
86719
86721
  const onGeometryChangeRef = useRef(null);
86720
86722
  onGeometryChangeRef.current = () => {
86721
- settleWindow();
86722
- if (heldSomewhere) {
86723
- placeWhereHeld();
86724
- return true;
86723
+ if (!heldSomewhere) {
86724
+ return false;
86725
86725
  }
86726
- // Items that came in at another size than what stood in for them (a
86727
- // skeleton becoming its item) leave the window short of the screen, or past
86728
- // it, and nothing scrolled to say so.
86726
+ settleWindow();
86727
+ placeWhereHeld();
86728
+ return true;
86729
+ };
86730
+ // Items that came in at another size than what stood in for them (a
86731
+ // skeleton becoming its item) leave the window short of the screen, or past
86732
+ // it, and nothing scrolled to say so. Asked on the next frame, not inside
86733
+ // the resize delivery: the window it frames is a render, which resizes what
86734
+ // is observed once more, and the browser gives up on the loop
86735
+ // ("ResizeObserver loop completed with undelivered notifications").
86736
+ const onItemsResizedRef = useRef(null);
86737
+ onItemsResizedRef.current = () => {
86738
+ settleWindow();
86729
86739
  evaluateWindowRef.current("items resized");
86730
- return false;
86731
86740
  };
86732
86741
  // The box around a held list changing shape is the hold's to answer too: it
86733
86742
  // places the list again, the way it writes every scroll of its own (see
@@ -86876,10 +86885,20 @@ const useListScrollSync = ({
86876
86885
  // which this would undo. The SCROLLER resizing is the window around it
86877
86886
  // changing shape, and then the item that was at the top goes back where it
86878
86887
  // was.
86888
+ let itemsResizedFrame;
86879
86889
  const putTopItemBack = entries => {
86880
86890
  const listResized = entries.some(entry => entry.target === listEl);
86881
- if (listResized && onGeometryChangeRef.current()) {
86882
- return;
86891
+ if (listResized) {
86892
+ if (onGeometryChangeRef.current()) {
86893
+ return;
86894
+ }
86895
+ cancelAnimationFrame(itemsResizedFrame);
86896
+ itemsResizedFrame = requestAnimationFrame(() => {
86897
+ if (pageLeftRef.current) {
86898
+ return;
86899
+ }
86900
+ onItemsResizedRef.current();
86901
+ });
86883
86902
  }
86884
86903
  if (!entries.some(entry => entry.target === scrollerEl)) {
86885
86904
  return;
@@ -86932,6 +86951,7 @@ const useListScrollSync = ({
86932
86951
  observer.observe(listEl);
86933
86952
  return () => {
86934
86953
  observer.disconnect();
86954
+ cancelAnimationFrame(itemsResizedFrame);
86935
86955
  };
86936
86956
  }, [scrollerElResolved]);
86937
86957
 
@@ -87537,7 +87557,7 @@ const useStuckWindowWarning = ({
87537
87557
  // Scrolling nothing, the box keeps out of reach only the items past what
87538
87558
  // it shows. A list standing whole on the window's screen is one the window
87539
87559
  // covers at its next evaluation: an item added in this commit is drawn on
87540
- // the resize it causes (see onGeometryChangeRef), after this effect.
87560
+ // the resize it causes (see onItemsResizedRef), after this effect.
87541
87561
  const listEl = getListEl();
87542
87562
  if (!listEl) {
87543
87563
  return;