π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Refactor TripLayout data processing and geocoding
anandbaburajane865c00d8fe3
diff --git a/web/apps/photos/src/components/TripLayout/utils/dataProcessing.ts b/web/apps/photos/src/components/TripLayout/utils/dataProcessing.tsindex 105c9c9592..c9ab63aeff 100644--- a/web/apps/photos/src/components/TripLayout/utils/dataProcessing.ts+++ b/web/apps/photos/src/components/TripLayout/utils/dataProcessing.ts@@ -85,9 +85,8 @@ export const fetchLocationNames = async ({return { updatedPhotos };}- for (let i = 0; i < photoClusters.length; i++) {- const cluster = photoClusters[i];- if (!cluster || cluster.length === 0) continue;+ for (const cluster of photoClusters) {+ if (cluster.length === 0) continue;const avgLat =cluster.reduce((sum, p) => sum + p.lat, 0) / cluster.length;@@ -95,7 +94,7 @@ export const fetchLocationNames = async ({cluster.reduce((sum, p) => sum + p.lng, 0) / cluster.length;try {- const locationInfo = await getLocationName(avgLat, avgLng, i + 1);+ const locationInfo = await getLocationName(avgLat, avgLng);cluster.forEach((photo) => {updatedPhotos.set(photo.fileId, {diff --git a/web/apps/photos/src/components/TripLayout/utils/geocoding.ts b/web/apps/photos/src/components/TripLayout/utils/geocoding.tsindex 7bfe6f4b4a..911f165d91 100644--- a/web/apps/photos/src/components/TripLayout/utils/geocoding.ts+++ b/web/apps/photos/src/components/TripLayout/utils/geocoding.ts@@ -94,10 +94,7 @@ export const getLocationName = async (result = { place: locationName, country: country };} else {// Fallback if no location found- result = {- place: "Unknown",- country: "Unknown",- };+ result = { place: "Unknown", country: "Unknown" };}// Cache the result@@ -105,10 +102,7 @@ export const getLocationName = async (return result;} catch {// Fallback on error- const fallbackResult = {- place: "Unknown",- country: "Unknown",- };+ const fallbackResult = { place: "Unknown", country: "Unknown" };// Cache the fallback to avoid repeated failuresgeocodingCache.set(cacheKey, fallbackResult);return fallbackResult;