π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[photos][web] Reset Places search and result scroll
AswinAsokd72e5690e687
diff --git a/web/apps/photos/src/components/gallery/BarImpl.tsx b/web/apps/photos/src/components/gallery/BarImpl.tsxindex b4717fb628..a34a8abe03 100644--- a/web/apps/photos/src/components/gallery/BarImpl.tsx+++ b/web/apps/photos/src/components/gallery/BarImpl.tsx@@ -199,6 +199,11 @@ export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({}}, [mode, mobile, mobileDrawerProps.open, collapsed]);+ const isPlacesView = !!placesFiles;+ useEffect(() => {+ if (!isPlacesView) setPlacesSearchQuery("");+ }, [isPlacesView]);+useEffect(() => {if (isSearching) {listRef.current?.scrollTo(0);diff --git a/web/apps/photos/src/components/gallery/PlacesList.tsx b/web/apps/photos/src/components/gallery/PlacesList.tsxindex 48e7214322..f246d90905 100644--- a/web/apps/photos/src/components/gallery/PlacesList.tsx+++ b/web/apps/photos/src/components/gallery/PlacesList.tsx@@ -12,7 +12,7 @@ import log from "ente-base/log";import type { EnteFile } from "ente-media/file";import { ItemCard, PreviewItemTile } from "ente-new/photos/components/Tiles";import { t } from "i18next";-import { useEffect, useState } from "react";+import { useEffect, useRef, useState } from "react";import { listPlaces } from "../../services/places";export interface PlaceSelection {@@ -31,6 +31,7 @@ export const PlacesList = ({selectedPlace?: PlaceSelection;onSelectPlace: (place: PlaceSelection | undefined) => void;}) => {+ const listRef = useRef<HTMLUListElement>(null);const [result, setResult] = useState<{files: EnteFile[];groups?: Awaited<ReturnType<typeof listPlaces>>;@@ -51,6 +52,10 @@ export const PlacesList = ({};}, [files]);+ useEffect(() => {+ if (listRef.current) listRef.current.scrollTop = 0;+ }, [searchQuery]);+const currentResult = result?.files === files ? result : undefined;const query = searchQuery.trim().toLowerCase();const matchingGroups = currentResult?.groups?.filter(({ city }) =>@@ -95,6 +100,7 @@ export const PlacesList = ({<Typography role="status">{t("no_results")}</Typography>) : (<List+ ref={listRef}disablePaddingaria-label={t("search_places")}sx={{