diff --git a/packages/marketplace/src/components/pages/apps/__tests__/__snapshots__/apps.test.tsx.snap b/packages/marketplace/src/components/pages/apps/__tests__/__snapshots__/apps.test.tsx.snap index 7003da795c..f79b958a60 100644 --- a/packages/marketplace/src/components/pages/apps/__tests__/__snapshots__/apps.test.tsx.snap +++ b/packages/marketplace/src/components/pages/apps/__tests__/__snapshots__/apps.test.tsx.snap @@ -83,7 +83,7 @@ exports[`Client should match a snapshot when LOADING false 1`] = ` hasMore={false} loader={} next={[Function]} - scrollThreshold="0px" + scrollThreshold={0.5} scrollableTarget="app-root-container" >
} next={[Function]} - scrollThreshold="0px" + scrollThreshold={0.5} scrollableTarget="app-root-container" >
() => setVisible(false) export const handleOnChange = history => (page: number) => { history.push(addQuery({ page })) @@ -100,7 +102,9 @@ export const Apps: React.FunctionComponent = () => { next={handleLoadMore({ dispatch, preview, loading, numOfItemsPerPage, pageNumber })} hasMore={hasMore} loader={} - scrollThreshold={`${comingSoonAppSectionHeight}px`} + scrollThreshold={ + comingSoonAppSectionHeight > 0 ? `${comingSoonAppSectionHeight}px` : DEFAULT_SCROLL_THRESHOLD + } // We disable the scrolling in the app list container and allow the app root container to scroll // so the scrollableTarget must be set as app-root-container scrollableTarget="app-root-container" diff --git a/packages/marketplace/src/components/pages/apps/coming-soon.tsx b/packages/marketplace/src/components/pages/apps/coming-soon.tsx index 929508a27f..59227042df 100644 --- a/packages/marketplace/src/components/pages/apps/coming-soon.tsx +++ b/packages/marketplace/src/components/pages/apps/coming-soon.tsx @@ -31,11 +31,11 @@ const comingSoonImagesList = [ ] export const handleSetComingSoonAppSectionHeight = ( - containerHeight: number, - setComingSoonAppSectionHeight: React.Dispatch> | undefined, + containerHeight?: number, + setComingSoonAppSectionHeight?: React.Dispatch> | undefined, ) => { return () => { - if (setComingSoonAppSectionHeight) { + if (containerHeight && setComingSoonAppSectionHeight) { setComingSoonAppSectionHeight(containerHeight) } } @@ -43,7 +43,7 @@ export const handleSetComingSoonAppSectionHeight = ( const ComingSoonApps: React.FC = ({ setComingSoonAppSectionHeight }) => { const containerRef = React.useRef(null) - const containerHeight = containerRef.current?.clientHeight || 0 + const containerHeight = containerRef.current?.clientHeight React.useEffect(handleSetComingSoonAppSectionHeight(containerHeight, setComingSoonAppSectionHeight), [ containerHeight,