Skip to content

Commit 49b4627

Browse files
authored
Do not cache top packages if search result list empty (search not ready). (#8068)
1 parent 30ee4e1 commit 49b4627

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/lib/search/top_packages.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ CachedValue<List<PackageView>> _cachedValue(
140140
// Do not apply rate limit here.
141141
rateLimitKey: null,
142142
);
143-
return page.packageHits;
143+
// Returning `null` will not cache the value, returning empty list gets cached.
144+
return page.errorMessage == null && page.packageHits.isNotEmpty
145+
? page.packageHits
146+
: null;
144147
},
145148
);
146149
}

0 commit comments

Comments
 (0)