Fix init/select out of sync issues.

This commit is contained in:
Dermot Duffy
2023-09-05 20:39:54 -07:00
parent 25150be36b
commit 1a4d38e609
4 changed files with 27 additions and 22 deletions
+3 -1
View File
@@ -434,7 +434,9 @@ export class FrigateCardLiveCarousel extends LitElement {
protected _getSelectedCameraIndex(): number {
const cameraIDs = this.cameraManager?.getStore().getVisibleCameraIDs();
if (!cameraIDs || !this.view) {
if (!cameraIDs || !this.view || this.viewFilterCameraID) {
// If the carousel is limited to a single cameraID, the first (only)
// element is always the selected one.
return 0;
}
return Math.max(0, Array.from(cameraIDs).indexOf(this.view.camera));