Skip to content

Commit

Permalink
Merge pull request #356 from reservoirprotocol/armando/grwth-3407-red…
Browse files Browse the repository at this point in the history
…uce-the-additional-api-call-to-ethereum-chain-on-home

Reduce the additional api call to ethereum chain on home
  • Loading branch information
r3lays authored Nov 1, 2023
2 parents a19d48a + 148d3a1 commit 783039a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pages/[chain]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Layout from 'components/Layout'
import { paths } from '@reservoir0x/reservoir-sdk'
import { useContext, useEffect, useState } from 'react'
import { Footer } from 'components/home/Footer'
import { useMarketplaceChain } from 'hooks'
import { useMarketplaceChain, useMounted } from 'hooks'
import supportedChains, { DefaultChain } from 'utils/chains'
import { Head } from 'components/Head'
import { ChainContext } from 'context/ChainContextProvider'
Expand All @@ -32,6 +32,7 @@ const StyledImage = styled('img', {})
const Home: NextPage<any> = ({ ssr }) => {
const router = useRouter()
const marketplaceChain = useMarketplaceChain()
const isMounted = useMounted()

// not sure if there is a better way to fix this
const { theme: nextTheme } = useTheme()
Expand All @@ -58,7 +59,7 @@ const Home: NextPage<any> = ({ ssr }) => {
? ssr.topSellingCollections[marketplaceChain.id]
: null,
},
chain?.id
isMounted ? chain?.id : undefined,
)

const topCollection = topSellingCollectionsData?.collections?.[0]
Expand Down
2 changes: 1 addition & 1 deletion pages/portfolio/[[...address]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const IndexPage: NextPage = () => {
data: collections,
isLoading: collectionsLoading,
fetchNextPage,
} = useUserCollections(address as string, collectionQuery)
} = useUserCollections(isMounted ? (address as string) : '', collectionQuery)

// Batch listing logic
const [showListingPage, setShowListingPage] = useState(false)
Expand Down

1 comment on commit 783039a

@vercel
Copy link

@vercel vercel bot commented on 783039a Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.