Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Inline

Manav Rathi17e57b748623
diff --git a/web/apps/photos/src/pages/gallery/index.tsx b/web/apps/photos/src/pages/gallery/index.tsx
index f5f4d52ddc..1c72be1727 100644
--- a/web/apps/photos/src/pages/gallery/index.tsx
+++ b/web/apps/photos/src/pages/gallery/index.tsx
@@ -119,7 +119,6 @@ import {
splitNormalAndHiddenCollections,
} from "utils/collection";
import ComlinkSearchWorker from "utils/comlink/ComlinkSearchWorker";
-import { preloadImage } from "utils/common";
import {
FILE_OPS_TYPE,
constructFileToCollectionMap,
@@ -1263,6 +1262,15 @@ function useEffectSingleThreaded(
}, deps);
}
+/**
+ * Preload all three variants of a responsive image.
+ */
+const preloadImage = (imgBasePath: string) => {
+ const srcset = [];
+ for (let i = 1; i <= 3; i++) srcset.push(`${imgBasePath}/${i}x.png ${i}x`);
+ new Image().srcset = srcset.join(",");
+};
+
const mergeMaps = <K, V>(map1: Map<K, V>, map2: Map<K, V>) => {
const mergedMap = new Map<K, V>(map1);
map2.forEach((value, key) => {
diff --git a/web/apps/photos/src/utils/common/index.ts b/web/apps/photos/src/utils/common/index.ts
index 63d9357ebd..3472c116e9 100644
--- a/web/apps/photos/src/utils/common/index.ts
+++ b/web/apps/photos/src/utils/common/index.ts
@@ -1,11 +1,3 @@
-export const preloadImage = (imgBasePath: string) => {
- const srcSet = [];
- for (let i = 1; i <= 3; i++) {
- srcSet.push(`${imgBasePath}/${i}x.png ${i}x`);
- }
- new Image().srcset = srcSet.join(",");
-};
-
export function batch<T>(arr: T[], batchSize: number): T[][] {
const batches: T[][] = [];
for (let i = 0; i < arr.length; i += batchSize) {