Skip to content

Commit 8778051

Browse files
committed
Merge branch 'fix--cache-behavior-when-limit-is-applied' into feat-inbox-outbox
2 parents 6f2b924 + 07a1c59 commit 8778051

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/domain_layer/usecases/cache_read/cache_read.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ class CacheRead {
2727
since: filter.since,
2828
until: filter.until,
2929
);
30+
3031
foundEvents.addAll(foundAuthors);
3132

3233
// remove found authors from unresolved filter if it's not a subscription
33-
if (!requestState.isSubscription) {
34-
filter.authors!.removeWhere(
35-
(author) => foundEvents.any((event) => event.pubKey == author),
36-
);
34+
if (!requestState.isSubscription && foundAuthors.isNotEmpty) {
35+
if ((filter.limit != null && foundEvents.length >= filter.limit!)) {
36+
filter.authors!.removeWhere(
37+
(author) => foundEvents.any((event) => event.pubKey == author),
38+
);
39+
}
3740
}
3841
}
3942

0 commit comments

Comments
 (0)