Merge pull request #1503 from dermotduffy/adoption

Fix query adopt bug
This commit is contained in:
Dermot Duffy
2024-08-26 12:44:05 -07:00
committed by GitHub
5 changed files with 147 additions and 11 deletions
+10 -1
View File
@@ -7,6 +7,7 @@ import {
} from '../../config/types';
import { localize } from '../../localize/localize';
import { ClipsOrSnapshotsOrAll } from '../../types';
import { MediaQueriesClassifier } from '../../view/media-queries-classifier';
import { View, ViewParameters } from '../../view/view';
import { getCameraIDsForViewName } from '../../view/view-to-cameras';
import { CardViewAPI } from '../types';
@@ -221,7 +222,15 @@ export class ViewFactory {
const switchingToGalleryFromViewer =
baseView?.isViewerView() && view.isGalleryView();
if (switchingToGalleryFromViewer && baseView?.query && baseView?.queryResults) {
const alreadyHasMatchingQuery =
mediaType === MediaQueriesClassifier.getMediaType(baseView?.query);
if (
switchingToGalleryFromViewer &&
alreadyHasMatchingQuery &&
baseView?.query &&
baseView?.queryResults
) {
// If the user is currently using the viewer, and then switches to the
// gallery we make an attempt to keep the query/queryResults the same so
// the gallery can be used to click back and forth to the viewer, and the