diff --git a/app/src/main/java/org/mozilla/fenix/components/history/PagedHistoryProvider.kt b/app/src/main/java/org/mozilla/fenix/components/history/PagedHistoryProvider.kt index 2f6760e2e7..7069fecc1c 100644 --- a/app/src/main/java/org/mozilla/fenix/components/history/PagedHistoryProvider.kt +++ b/app/src/main/java/org/mozilla/fenix/components/history/PagedHistoryProvider.kt @@ -155,8 +155,10 @@ class DefaultPagedHistoryProvider( // items. val historyGroupsInOffset = if (history.isNotEmpty()) { historyGroups?.filter { - history.last().visitedAt <= it.visitedAt - visitedAtBuffer && - it.visitedAt - visitedAtBuffer <= (history.first().visitedAt + visitedAtBuffer) + it.items.any { item -> + history.last().visitedAt <= item.visitedAt - visitedAtBuffer && + item.visitedAt - visitedAtBuffer <= (history.first().visitedAt + visitedAtBuffer) + } } ?: emptyList() } else { emptyList() diff --git a/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt b/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt index e2f572d743..32a041c154 100644 --- a/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt @@ -59,7 +59,7 @@ class PagedHistoryProviderTest { val historyEntry1 = HistoryMetadata( key = historyMetadataKey1, title = "mozilla", - createdAt = 5, + createdAt = 150000000, // a large amount to fall outside of the history page. updatedAt = 10, totalViewTime = 10, documentType = DocumentType.Regular,