Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use a callback ref so that it's always updated

Manav Rathi374625f5b38a
diff --git a/web/apps/photos/src/components/Collections/CollectionListBar.tsx b/web/apps/photos/src/components/Collections/CollectionListBar.tsx
index 9c01c6fa73..0c2e6ade8d 100644
--- a/web/apps/photos/src/components/Collections/CollectionListBar.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionListBar.tsx
@@ -102,6 +102,9 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({
// const windowSize = useWindowSize();
const isMobile = useIsMobileWidth();
+ const listContainerCallbackRef = useCallback((node) => {
+ listContainerRef.current = node;
+ }, []);
const listContainerRef = useRef<HTMLDivElement>(null);
const listRef = useRef(null);
@@ -216,7 +219,7 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({
{({ width }) => (
<FixedSizeList
ref={listRef}
- outerRef={listContainerRef}
+ outerRef={listContainerCallbackRef}
itemData={itemData}
layout="horizontal"
width={width}