thirdweb-dev / react

Ultimate collection of React hooks for your web3 apps
https://docs.thirdweb.com/react
Apache License 2.0
80 stars 29 forks source link

useNFTs throws an error #70

Closed 7flash closed 2 years ago

7flash commented 2 years ago

Code example:

  const NFTContract = useNFTCollection('0x64903fbd6eedaa7eeb5e79e24597a90e62a3de0c');
  const { data: nfts, isLoading, error } = useNFTs(NFTContract, { start: 0, count: 100 });

  useEffect(() => {
    console.log('nfts', nfts);
    console.log('error', error);
  }, [nfts, isLoading, error]);

Result:

image

jnsdls commented 2 years ago

hey @7flash, which chain is this nft collection on? I'd love to be able to reproduce this, it would massively help in tracking down the problem and fixing it! thanks!

7flash commented 2 years ago

hey @7flash, which chain is this nft collection on? I'd love to be able to reproduce this, it would massively help in tracking down the problem and fixing it! thanks!

Ethereum Mainnet..

jnsdls commented 2 years ago

@7flash ok, I took a look, here's what I have so far:

The error being thrown in this case is definitely confusing but it looks to me like the underlying error is in the setup of the metadata / server configuration in this case. I'll leave this open for now because we do need to handle these errors when they happen better.

jnsdls commented 2 years ago

assuming this is solved / explained. Closing. (Feel free to re-open if there are further questions.)

7flash commented 2 years ago

But the collection above is being properly fetched by both Opensea API and Moralis API..

7flash commented 2 years ago

Maybe because they are sending requests from the server.. and this library is sending request directly from the browser.. is that correct..

jnsdls commented 2 years ago

But the collection above is being properly fetched by both Opensea API and Moralis API..

yup, both of those use indexers (servers that aggregate all the data on-chain and store it in a traditional database) => then they read it from the database.

Maybe because they are sending requests from the server.. and this library is sending request directly from the browser.. is that correct...

yep, this is indeed correct