Closed florian-bellotti closed 1 year ago
The useNetwork hook doesn't detect network change.
https://github.com/apibara/starknet-react/blob/a725fa891960f95a0dbf8994a420ff23f2738e34/packages/core/src/hooks/network.ts#L31
Replacing line 31 with something like this could fix the bug.
use [chain, setChain] = useState<Chain>(); // TODO: retrieve the default network value useEffet(() => { if (!library) return; library.getChainId().then((chainId) => setChain(chainById(chainId))); }, [library])
You're right. What's happening is that the query doesn't have a key so it won't refresh. Fix incoming.
The useNetwork hook doesn't detect network change.
https://github.com/apibara/starknet-react/blob/a725fa891960f95a0dbf8994a420ff23f2738e34/packages/core/src/hooks/network.ts#L31
Replacing line 31 with something like this could fix the bug.