Only check for cache coverage of plausible dates.

This commit is contained in:
Dermot Duffy
2022-06-04 11:04:38 -07:00
parent 42c8251c20
commit e03f3cf7f8
+6 -10
View File
@@ -269,14 +269,15 @@ class TimelineDataManager {
end: Date, end: Date,
recordings?: boolean, recordings?: boolean,
): Promise<boolean> { ): Promise<boolean> {
// Cannot fetch the future, always clip the end date to now so as to avoid
// checking for coverage that could not possibly exist yet.
const now = new Date(); const now = new Date();
end = end > now ? now : end;
if (this.hasCoverage(now, start, end)) { if (this.hasCoverage(now, start, end)) {
return false; return false;
} }
// Cannot fetch the future.
end = end > now ? now : end;
if (!this._dateStart || start < this._dateStart) { if (!this._dateStart || start < this._dateStart) {
this._dateStart = start; this._dateStart = start;
} }
@@ -1013,12 +1014,7 @@ export class FrigateCardTimelineCore extends LitElement {
disabled: false, disabled: false,
filterOptions: { filterOptions: {
whiteList: { whiteList: {
'frigate-card-thumbnail': [ 'frigate-card-thumbnail': ['details', 'thumbnail', 'label', 'event'],
'details',
'thumbnail',
'label',
'event',
],
div: ['title'], div: ['title'],
span: ['style'], span: ['style'],
}, },
@@ -1115,7 +1111,7 @@ export class FrigateCardTimelineCore extends LitElement {
// -> New view dispatched (to load thumbnails into outer carousel). // -> New view dispatched (to load thumbnails into outer carousel).
// -> New view received ... [loop] // -> New view received ... [loop]
const currentContext = this.view.context as TimelineViewContext | null; const currentContext = this.view.context as TimelineViewContext | null;
if (currentContext?.dateFetch !== this._data.lastFetchDate) { if (!isEqual(currentContext?.dateFetch, this._data.lastFetchDate)) {
const thumbnails = this._generateThumbnails(); const thumbnails = this._generateThumbnails();
this.view this.view
?.evolve({ ?.evolve({