Only check for cache coverage of plausible dates.
This commit is contained in:
@@ -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({
|
||||||
@@ -1151,7 +1147,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
* Called when an update will occur.
|
* Called when an update will occur.
|
||||||
* @param changedProps The changed properties
|
* @param changedProps The changed properties
|
||||||
*/
|
*/
|
||||||
protected willUpdate(changedProps: PropertyValues): void {
|
protected willUpdate(changedProps: PropertyValues): void {
|
||||||
if (changedProps.has('timelineConfig')) {
|
if (changedProps.has('timelineConfig')) {
|
||||||
if (this.timelineConfig?.controls.thumbnails.size) {
|
if (this.timelineConfig?.controls.thumbnails.size) {
|
||||||
this.style.setProperty(
|
this.style.setProperty(
|
||||||
|
|||||||
Reference in New Issue
Block a user