π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fin
Manav Rathie94b1966bd0f
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsxindex 24bc6c089d..c9bcf6993f 100644--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx@@ -23,7 +23,7 @@ import { CollectionsSortBy } from "ente-new/photos/services/collection/ui";import { FlexWrapper, FluidContainer } from "ente-shared/components/Container";import { t } from "i18next";import memoize from "memoize-one";-import React, { useEffect, useMemo, useRef, useState } from "react";+import React, { useEffect, useRef, useState } from "react";import AutoSizer from "react-virtualized-auto-sizer";import { areEqual, FixedSizeList, ListChildComponentProps } from "react-window";@@ -196,13 +196,18 @@ const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({onCollectionClick,}) => {const isTwoColumn = useMediaQuery(`(width < ${Column3To2Breakpoint}px)`);- const columns = isTwoColumn ? 2 : 3;const refreshInProgress = useRef(false);const shouldRefresh = useRef(false);const [collectionRowList, setCollectionRowList] = useState([]);+ const columns = isTwoColumn ? 2 : 3;+ const maxListContentHeight =+ Math.ceil(collectionSummaries.length / columns) *+ CollectionRowItemSize ++ 32; /* padding above first and below last row */+useEffect(() => {if (!collectionSummaries) {return;@@ -235,27 +240,24 @@ const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({}};main();- }, [collectionSummaries]);+ }, [collectionSummaries, columns]);// Bundle additional data to list items using the "itemData" prop.// It will be accessible to item renderers as props.data.// Memoize this data to avoid bypassing shouldComponentUpdate().const itemData = createItemData(collectionRowList, onCollectionClick);- const maxListContentHeight = useMemo(- () =>- Math.ceil(collectionSummaries.length / columns) *- CollectionRowItemSize +- 32 /* padding above first and below last row */,- [collectionSummaries],- );-return (<DialogContentsx={{"&&": { padding: 0 },- height: `min(80svh, ${maxListContentHeight}px)`,+ height: "min(80svh, var(--et-max-list-content-height))",}}+ style={+ {+ "--et-max-list-content-height": `${maxListContentHeight}px`,+ } as React.CSSProperties+ }><AutoSizer>{({ width, height }) => (diff --git a/web/packages/shared/hooks/useWindowSize.tsx b/web/packages/shared/hooks/useWindowSize.tsxdeleted file mode 100644index 2b0cad3468..0000000000--- a/web/packages/shared/hooks/useWindowSize.tsx+++ /dev/null@@ -1,34 +0,0 @@-// https://usehooks.com/useWindowSize/-import { useEffect, useState } from "react";--// Hook-export default function useWindowSize() {- // Initialize state with undefined width/height so server and client renders match- // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/- const [windowSize, setWindowSize] = useState<{- width: number;- height: number;- }>({ width: undefined, height: undefined });-- useEffect(() => {- // Handler to call on window resize- function handleResize() {- // Set window width/height to state- setWindowSize({- width: window.innerWidth,- height: window.innerHeight,- });- }-- // Add event listener- window.addEventListener("resize", handleResize);-- // Call handler right away so state gets updated with initial window size- handleResize();-- // Remove event listener on cleanup- return () => window.removeEventListener("resize", handleResize);- }, []); // Empty array ensures that effect is only run on mount-- return windowSize;-}