Feed: eager-load all year shards when a date filter is active
The initial page load only fetches the most recent year shard. Selecting a date range or year preset that spans an older shard returned no results because those shards were never loaded. Extend the existing search eager-load trigger to also fire on any non-empty dateFrom, covering both custom date inputs and year preset buttons.
This commit is contained in:
@@ -132,10 +132,10 @@
|
|||||||
|
|
||||||
$: if (sport || datePre || query || customFrom || customTo) shown = PAGE_SIZE; // reset pagination on filter change
|
$: if (sport || datePre || query || customFrom || customTo) shown = PAGE_SIZE; // reset pagination on filter change
|
||||||
|
|
||||||
// When a search query is active, eagerly load all remaining shards so the
|
// When a search query or any date filter is active, eagerly load all
|
||||||
// full history is searched (not just the initially-loaded recent year).
|
// remaining shards so results aren't limited to the initially-loaded year.
|
||||||
let loadingAllShards = false;
|
let loadingAllShards = false;
|
||||||
$: if (query.trim() && pendingShards.length > 0 && !loadingAllShards) {
|
$: if ((query.trim() || dateFrom) && pendingShards.length > 0 && !loadingAllShards) {
|
||||||
loadingAllShards = true;
|
loadingAllShards = true;
|
||||||
(async () => {
|
(async () => {
|
||||||
while (pendingShards.length > 0) {
|
while (pendingShards.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user