Fix bug that caused gallery to render wrong media type.

This commit is contained in:
Dermot Duffy
2023-03-18 14:39:57 -07:00
parent 37fd5b5aff
commit 7c0da1b267
2 changed files with 44 additions and 22 deletions
+4 -21
View File
@@ -93,6 +93,8 @@ import { FrigateCardInitializer } from './utils/initializer.js';
import 'web-dialog';
import { downloadMedia } from './utils/download.js';
import { getActionsFromQueryString } from './utils/querystring.js';
import { MediaQueries } from './view/media-queries.js';
import { MediaQuery } from './camera-manager/types.js';
/** A note on media callbacks:
*
@@ -633,9 +635,7 @@ class FrigateCard extends LitElement {
...this._getConfig().menu.buttons.expand,
type: 'custom:frigate-card-menu-icon',
title: localize('config.menu.buttons.expand'),
tap_action: createFrigateCardCustomAction(
'expand',
) as FrigateCardCustomAction,
tap_action: createFrigateCardCustomAction('expand') as FrigateCardCustomAction,
style: this._expand ? this._getEmphasizedStyle() : {},
});
@@ -860,24 +860,7 @@ class FrigateCard extends LitElement {
this._resetMainScroll();
}
// Special case: If the user is currently using the viewer, and then
// switches to the gallery (no matter how), make an attempt to keep the
// query/queryResults the same so the gallery can be used to click bath
// and forth to the viewer, and the selected media can be centered in the
// gallery. See the matching code in `updated()` in `gallery.ts`.
// See: https://github.com/dermotduffy/frigate-hass-card/issues/885
if (
this._view?.isViewerView() &&
view.isGalleryView() &&
(!view.query || !view.queryResults)
) {
if (this._view?.query) {
view.query = this._view.query;
}
if (this._view?.queryResults) {
view.queryResults = this._view.queryResults;
}
}
View.adoptQueryIfAppropriate(view, this._view);
this._view = view;
this._generateConditionState();