apibara/starknet-react

useStarkProfile() error on custom chains

rsodre opened this issue · 3 comments

Calling useStarkProfile({address}) on a custom chain that does not have an id contract results in client error.

The hook should verify if the contract exists before selecting the multicall function.

index.js:1838 Uncaught TypeError: Cannot read properties of undefined (reading 'multicall')
    at useStarkProfile (index.js:1838:48)
    at WalletHeader (WalletHeader.tsx:16:53)
    at renderWithHooks (react-dom.development.js:16305:18)
    at mountIndeterminateComponent (react-dom.development.js:20069:13)
    at beginWork (react-dom.development.js:21582:16)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:16)
    at invokeGuardedCallback (react-dom.development.js:4277:31)
    at beginWork$1 (react-dom.development.js:27446:7)
    at performUnitOfWork (react-dom.development.js:26552:12)
    at workLoopSync (react-dom.development.js:26461:5)
    at renderRootSync (react-dom.development.js:26429:7)
    at performConcurrentWorkOnRoot (react-dom.development.js:25733:74)
    at workLoop (scheduler.development.js:266:34)
    at flushWork (scheduler.development.js:239:14)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:533:21)

Good catch thank you!

Hi @fracek, can I proceed to fix this bug?

Hi @fracek, can I proceed to fix this bug?

Happy to review a pr that fixes this.