timeline: make fetchDay once explicitly
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/900/head
parent
eec6e0a492
commit
e13e9cb37b
|
@ -866,6 +866,9 @@ export default defineComponent({
|
||||||
|
|
||||||
/** Fetch image data for one dayId */
|
/** Fetch image data for one dayId */
|
||||||
async fetchDay(dayId: number, now = false) {
|
async fetchDay(dayId: number, now = false) {
|
||||||
|
if (!now && this.loadedDays.has(dayId)) return;
|
||||||
|
|
||||||
|
// Get head to ensure the day exists / is valid
|
||||||
const head = this.heads[dayId];
|
const head = this.heads[dayId];
|
||||||
if (!head) return;
|
if (!head) return;
|
||||||
|
|
||||||
|
@ -910,17 +913,13 @@ export default defineComponent({
|
||||||
now ||= this.fetchDayQueue.reduce((sum, dayId) => sum + this.heads[dayId]?.day?.count ?? 0, 0) > 256;
|
now ||= this.fetchDayQueue.reduce((sum, dayId) => sum + this.heads[dayId]?.day?.count ?? 0, 0) > 256;
|
||||||
|
|
||||||
// Process immediately
|
// Process immediately
|
||||||
if (now) {
|
if (now) return await this.fetchDayExpire();
|
||||||
return this.fetchDayExpire();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Defer for aggregation
|
// Defer for aggregation
|
||||||
if (!this.fetchDayTimer) {
|
this.fetchDayTimer ??= window.setTimeout(() => {
|
||||||
this.fetchDayTimer = window.setTimeout(() => {
|
this.fetchDayTimer = null;
|
||||||
this.fetchDayTimer = null;
|
this.fetchDayExpire();
|
||||||
this.fetchDayExpire();
|
}, 150);
|
||||||
}, 150);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async fetchDayExpire() {
|
async fetchDayExpire() {
|
||||||
|
|
Loading…
Reference in New Issue