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,
recordings?: 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();
end = end > now ? now : end;
if (this.hasCoverage(now, start, end)) {
return false;
}
// Cannot fetch the future.
end = end > now ? now : end;
if (!this._dateStart || start < this._dateStart) {
this._dateStart = start;
}
@@ -1013,12 +1014,7 @@ export class FrigateCardTimelineCore extends LitElement {
disabled: false,
filterOptions: {
whiteList: {
'frigate-card-thumbnail': [
'details',
'thumbnail',
'label',
'event',
],
'frigate-card-thumbnail': ['details', 'thumbnail', 'label', 'event'],
div: ['title'],
span: ['style'],
},
@@ -1115,7 +1111,7 @@ export class FrigateCardTimelineCore extends LitElement {
// -> New view dispatched (to load thumbnails into outer carousel).
// -> New view received ... [loop]
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();
this.view
?.evolve({