diff --git a/web/components/contract-search.tsx b/web/components/contract-search.tsx index 265b25c6..8bc1341f 100644 --- a/web/components/contract-search.tsx +++ b/web/components/contract-search.tsx @@ -345,7 +345,6 @@ export function ContractSearch(props: { void - hasMore: boolean + loadMore?: () => void showTime?: ShowTime onContractClick?: (contract: Contract) => void overrideGridClassName?: string @@ -31,7 +30,6 @@ export function ContractsGrid(props: { const { contracts, showTime, - hasMore, loadMore, onContractClick, overrideGridClassName, @@ -39,16 +37,15 @@ export function ContractsGrid(props: { highlightOptions, } = props const { hideQuickBet, hideGroupLink } = cardHideOptions || {} - const { contractIds, highlightClassName } = highlightOptions || {} - const [elem, setElem] = useState(null) - const isBottomVisible = useIsVisible(elem) - - useEffect(() => { - if (isBottomVisible && hasMore) { - loadMore() - } - }, [isBottomVisible, hasMore, loadMore]) + const onVisibilityUpdated = useCallback( + (visible) => { + if (visible && loadMore) { + loadMore() + } + }, + [loadMore] + ) if (contracts === undefined) { return @@ -92,7 +89,10 @@ export function ContractsGrid(props: { /> ))} -
+ ) } diff --git a/web/components/feed/feed-items.tsx b/web/components/feed/feed-items.tsx index b1cd765c..d60fb8da 100644 --- a/web/components/feed/feed-items.tsx +++ b/web/components/feed/feed-items.tsx @@ -1,5 +1,5 @@ // From https://tailwindui.com/components/application-ui/lists/feeds -import React, { useState } from 'react' +import React from 'react' import { BanIcon, CheckIcon, @@ -22,7 +22,6 @@ import { UserLink } from '../user-page' import BetRow from '../bet-row' import { Avatar } from '../avatar' import { ActivityItem } from './activity-items' -import { useSaveSeenContract } from 'web/hooks/use-seen-contracts' import { useUser } from 'web/hooks/use-user' import { trackClick } from 'web/lib/firebase/tracking' import { DAY_MS } from 'common/util/time' @@ -50,11 +49,8 @@ export function FeedItems(props: { const { contract, items, className, betRowClassName, user } = props const { outcomeType } = contract - const [elem, setElem] = useState(null) - useSaveSeenContract(elem, contract) - return ( -
+
{items.map((item, activityItemIdx) => (
diff --git a/web/components/landing-page-panel.tsx b/web/components/landing-page-panel.tsx index 4b436442..2e3d85e2 100644 --- a/web/components/landing-page-panel.tsx +++ b/web/components/landing-page-panel.tsx @@ -59,11 +59,7 @@ export function LandingPagePanel(props: { hotContracts: Contract[] }) {
- {}} - hasMore={false} - showTime={showTime} - /> +
) }