@adventurelabs/scout-core 1.4.27 → 1.4.28
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.
|
@@ -457,11 +457,13 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
|
|
|
457
457
|
? currentQuery.data.items
|
|
458
458
|
: [];
|
|
459
459
|
const limit = options.limit || 20;
|
|
460
|
-
//
|
|
461
|
-
|
|
460
|
+
// Defer lastResult to next tick so consumer's IntersectionObserver is recreated
|
|
461
|
+
// after hasMore is true and its callback can fire (sentinel may already be in view).
|
|
462
|
+
const nextResult = {
|
|
462
463
|
hasMore: currentQuery.data.hasMore ?? false,
|
|
463
464
|
nextCursor: currentQuery.data.nextCursor ?? null,
|
|
464
|
-
}
|
|
465
|
+
};
|
|
466
|
+
queueMicrotask(() => setLastResult(nextResult));
|
|
465
467
|
setPages((prev) => {
|
|
466
468
|
const existingPage = prev.find((p) => feedCursorEq(p.cursor, currentCursor));
|
|
467
469
|
if (!existingPage) {
|
|
@@ -549,10 +551,11 @@ export const useInfiniteFeedByDevice = (deviceId, options) => {
|
|
|
549
551
|
if (pagesLengthRef.current > 0 &&
|
|
550
552
|
feedCursorEq(lastAddedCursorRef.current ?? null, currentCursor))
|
|
551
553
|
return;
|
|
552
|
-
|
|
554
|
+
const nextResult = {
|
|
553
555
|
hasMore: currentQuery.data?.hasMore ?? false,
|
|
554
556
|
nextCursor: currentQuery.data?.nextCursor ?? null,
|
|
555
|
-
}
|
|
557
|
+
};
|
|
558
|
+
queueMicrotask(() => setLastResult(nextResult));
|
|
556
559
|
setPages((prev) => {
|
|
557
560
|
const existingPage = prev.find((p) => feedCursorEq(p.cursor, currentCursor));
|
|
558
561
|
if (!existingPage) {
|