@jsenv/navi 0.27.84 → 0.27.85
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.
- package/dist/jsenv_navi.js +20 -3
- package/dist/jsenv_navi.js.map +4 -2
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -42510,7 +42510,10 @@ const getScrollInfo = (scrollValues, listScrollContainerEl, tracker, virtualItem
|
|
|
42510
42510
|
break;
|
|
42511
42511
|
}
|
|
42512
42512
|
}
|
|
42513
|
-
|
|
42513
|
+
// Shared by the "hit a filler" and "hit nothing at all" cases below: both
|
|
42514
|
+
// mean we don't know the real on-screen index, only the scroll position,
|
|
42515
|
+
// so estimate from it rather than assume nothing changed.
|
|
42516
|
+
const estimateFromScrollPos = reasonPrefix => {
|
|
42514
42517
|
const virtualItemSize = virtualItemSizeSignal.peek();
|
|
42515
42518
|
if (virtualItemSize === 0) {
|
|
42516
42519
|
return null;
|
|
@@ -42520,8 +42523,11 @@ const getScrollInfo = (scrollValues, listScrollContainerEl, tracker, virtualItem
|
|
|
42520
42523
|
return {
|
|
42521
42524
|
item: items[index],
|
|
42522
42525
|
index,
|
|
42523
|
-
reason:
|
|
42526
|
+
reason: `${reasonPrefix}, estimated at ${index} (${items[index]?.value})`
|
|
42524
42527
|
};
|
|
42528
|
+
};
|
|
42529
|
+
if (hitFiller) {
|
|
42530
|
+
return estimateFromScrollPos("hit filler");
|
|
42525
42531
|
}
|
|
42526
42532
|
if (hitEl) {
|
|
42527
42533
|
const hitId = hitEl.id;
|
|
@@ -42535,11 +42541,22 @@ const getScrollInfo = (scrollValues, listScrollContainerEl, tracker, virtualItem
|
|
|
42535
42541
|
reason: `hit item at ${index} (${items[index].value})`
|
|
42536
42542
|
};
|
|
42537
42543
|
}
|
|
42544
|
+
// Neither a real item nor a filler was hit within listEl — e.g. part of
|
|
42545
|
+
// the scan range fell outside the page's actually reachable viewport
|
|
42546
|
+
// (docked devtools shrinks it, for one). Keeping the stale renderWindow
|
|
42547
|
+
// here (as this used to do) means the DOM never gets asked to catch up
|
|
42548
|
+
// with a scrollTop that may have jumped far away — the user ends up
|
|
42549
|
+
// staring at filler space. Same estimate as the hitFiller case is a safe
|
|
42550
|
+
// fallback: it only needs the scroll position, not a successful hit-test.
|
|
42551
|
+
const estimated = estimateFromScrollPos("no hit");
|
|
42552
|
+
if (estimated) {
|
|
42553
|
+
return estimated;
|
|
42554
|
+
}
|
|
42538
42555
|
const fallbackIndex = renderWindowRef.current.start;
|
|
42539
42556
|
return {
|
|
42540
42557
|
item: items[fallbackIndex],
|
|
42541
42558
|
index: fallbackIndex,
|
|
42542
|
-
reason: "no hit"
|
|
42559
|
+
reason: "no hit, no virtualItemSize yet"
|
|
42543
42560
|
};
|
|
42544
42561
|
};
|
|
42545
42562
|
const useVirtualItemSizeSignal = (ref, virtualItemSizeProp = 0, horizontal) => {
|