From a37ff3cf57a59b30d4fdff1f300f3d0026f19780 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 27 Sep 2024 10:53:28 +0530 Subject: [PATCH] Workarounds --- web/apps/photos/src/pages/gallery.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx index e36537c131..71c69d40d9 100644 --- a/web/apps/photos/src/pages/gallery.tsx +++ b/web/apps/photos/src/pages/gallery.tsx @@ -662,7 +662,10 @@ export default function Gallery() { activePersonID, ]); - const { filteredData, galleryPeopleState } = derived1; + const { filteredData, galleryPeopleState } = derived1 ?? { + filteredData: [], + galleryPeopleState: undefined, + }; // Calling setState during rendering is frowned upon for good reasons, but // it is not verboten, and it has documented semantics: @@ -674,7 +677,7 @@ export default function Gallery() { // // That said, we should try to refactor this code to use a reducer or some // other store so that this is not needed. - if (barMode == "people" && !galleryPeopleState) { + if (barMode == "people" && galleryPeopleState?.people.length === 0) { log.info( "Resetting gallery to all section since people mode is no longer valid", );