@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.
@@ -84872,19 +84872,28 @@ const useListScrollSync = ({
84872
84872
  });
84873
84873
  }, []);
84874
84874
  // What to do when the list's own geometry moves under it, kept fresh for the
84875
- // observer below (which is installed once).
84875
+ // observer below (which is installed once). A held list is placed inside the
84876
+ // resize delivery, so the browser paints it where it lands; answers whether
84877
+ // it was.
84876
84878
  const onGeometryChangeRef = useRef(null);
84877
84879
  onGeometryChangeRef.current = () => {
84878
- settleWindow();
84879
- if (heldSomewhere) {
84880
- placeWhereHeld();
84881
- return true;
84880
+ if (!heldSomewhere) {
84881
+ return false;
84882
84882
  }
84883
- // Items that came in at another size than what stood in for them (a
84884
- // skeleton becoming its item) leave the window short of the screen, or past
84885
- // it, and nothing scrolled to say so.
84883
+ settleWindow();
84884
+ placeWhereHeld();
84885
+ return true;
84886
+ };
84887
+ // Items that came in at another size than what stood in for them (a
84888
+ // skeleton becoming its item) leave the window short of the screen, or past
84889
+ // it, and nothing scrolled to say so. Asked on the next frame, not inside
84890
+ // the resize delivery: the window it frames is a render, which resizes what
84891
+ // is observed once more, and the browser gives up on the loop
84892
+ // ("ResizeObserver loop completed with undelivered notifications").
84893
+ const onItemsResizedRef = useRef(null);
84894
+ onItemsResizedRef.current = () => {
84895
+ settleWindow();
84886
84896
  evaluateWindowRef.current("items resized");
84887
- return false;
84888
84897
  };
84889
84898
  // The box around a held list changing shape is the hold's to answer too: it
84890
84899
  // places the list again, the way it writes every scroll of its own (see
@@ -85032,10 +85041,20 @@ const useListScrollSync = ({
85032
85041
  // which this would undo. The SCROLLER resizing is the window around it
85033
85042
  // changing shape, and then the item that was at the top goes back where it
85034
85043
  // was.
85044
+ let itemsResizedFrame;
85035
85045
  const putTopItemBack = entries => {
85036
85046
  const listResized = entries.some(entry => entry.target === listEl);
85037
- if (listResized && onGeometryChangeRef.current()) {
85038
- return;
85047
+ if (listResized) {
85048
+ if (onGeometryChangeRef.current()) {
85049
+ return;
85050
+ }
85051
+ cancelAnimationFrame(itemsResizedFrame);
85052
+ itemsResizedFrame = requestAnimationFrame(() => {
85053
+ if (pageLeftRef.current) {
85054
+ return;
85055
+ }
85056
+ onItemsResizedRef.current();
85057
+ });
85039
85058
  }
85040
85059
  if (!entries.some(entry => entry.target === scrollerEl)) {
85041
85060
  return;
@@ -85088,6 +85107,7 @@ const useListScrollSync = ({
85088
85107
  observer.observe(listEl);
85089
85108
  return () => {
85090
85109
  observer.disconnect();
85110
+ cancelAnimationFrame(itemsResizedFrame);
85091
85111
  };
85092
85112
  }, [scrollerElResolved]);
85093
85113