Match the event name

This commit is contained in:
Manav Rathi
2024-09-23 16:59:39 +05:30
parent 42d36b35d2
commit 9a0ea3ac43

View File

@@ -79,6 +79,7 @@ export interface CollectionListBarProps {
onSelectPerson: (person: Person) => void;
}
// TODO-Cluster Rename me to GalleryBar
export const CollectionListBar: React.FC<CollectionListBarProps> = ({
mode,
setMode,
@@ -90,7 +91,7 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({
setCollectionListSortBy,
people,
activePerson,
// onSelectPerson
onSelectPerson
}) => {
const windowSize = useWindowSize();
const isMobile = useIsMobileWidth();
@@ -113,18 +114,19 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({
};
useEffect(() => {
if (!listWrapperRef.current) {
return;
}
// Add event listener
listWrapperRef.current?.addEventListener("scroll", updateScrollObj);
if (!listWrapperRef.current) return;
// Call handler right away so state gets updated with initial window size
// Add event listener.
listWrapperRef.current.addEventListener("scroll", updateScrollObj);
// Call handler right away so that state gets updated with initial
// window size.
updateScrollObj();
// Remove event listener on cleanup
// Remove event listener on cleanup.
return () =>
listWrapperRef.current?.removeEventListener(
"resize",
"scroll",
updateScrollObj,
);
}, [listWrapperRef.current]);