@adventurelabs/scout-core 1.4.21 → 1.4.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.
|
@@ -436,6 +436,10 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
|
|
|
436
436
|
}
|
|
437
437
|
prevHerdIdRef.current = herdId;
|
|
438
438
|
}, [herdId, options.enabled]);
|
|
439
|
+
// When we request a new page (cursor changed), clear ref so we merge the new response
|
|
440
|
+
useEffect(() => {
|
|
441
|
+
lastAddedCursorRef.current = undefined;
|
|
442
|
+
}, [currentCursor]);
|
|
439
443
|
useEffect(() => {
|
|
440
444
|
if (!currentQuery.data || currentQuery.isLoading)
|
|
441
445
|
return;
|
|
@@ -483,7 +487,9 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
|
|
|
483
487
|
items: allItems,
|
|
484
488
|
isLoading: currentQuery.isLoading && pages.length === 0,
|
|
485
489
|
isLoadingMore: currentQuery.isLoading && pages.length > 0,
|
|
486
|
-
hasMore: currentQuery.data?.hasMore ??
|
|
490
|
+
hasMore: (currentQuery.data?.hasMore ??
|
|
491
|
+
(currentCursor !== null && pages.length > 0)) ??
|
|
492
|
+
false,
|
|
487
493
|
loadMore,
|
|
488
494
|
refetch,
|
|
489
495
|
error: currentQuery.error,
|
|
@@ -511,6 +517,10 @@ export const useInfiniteFeedByDevice = (deviceId, options) => {
|
|
|
511
517
|
}
|
|
512
518
|
prevDeviceIdRef.current = deviceId;
|
|
513
519
|
}, [deviceId, options.enabled]);
|
|
520
|
+
// When we request a new page (cursor changed), clear ref so we merge the new response
|
|
521
|
+
useEffect(() => {
|
|
522
|
+
lastAddedCursorRef.current = undefined;
|
|
523
|
+
}, [currentCursor]);
|
|
514
524
|
useEffect(() => {
|
|
515
525
|
if (!currentQuery.data || currentQuery.isLoading)
|
|
516
526
|
return;
|
|
@@ -558,7 +568,9 @@ export const useInfiniteFeedByDevice = (deviceId, options) => {
|
|
|
558
568
|
items: allItems,
|
|
559
569
|
isLoading: currentQuery.isLoading && pages.length === 0,
|
|
560
570
|
isLoadingMore: currentQuery.isLoading && pages.length > 0,
|
|
561
|
-
hasMore: currentQuery.data?.hasMore ??
|
|
571
|
+
hasMore: (currentQuery.data?.hasMore ??
|
|
572
|
+
(currentCursor !== null && pages.length > 0)) ??
|
|
573
|
+
false,
|
|
562
574
|
loadMore,
|
|
563
575
|
refetch,
|
|
564
576
|
error: currentQuery.error,
|