[bug] Wallet disconnects when page refreshes
davedavinci opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
RainbowKit Version
1.3.3
wagmi Version
1.4.13
Current Behavior
After having connected the wallet to my RK dApp, I refresh the page and see the button turn into "Connect Wallet". Actually I don't need to confirm in metamask, because it's already connected. When I click con "Connect Wallet" it instantlty turns into displaying my wallet as connected and my balance.
Expected Behavior
I expect the dApp to display connection and be able to use my wallet without clicking on Connect Wallet button.
It used to work correctly since days ago. I must have changed something.
Might have something in common with this issue: #1839
I implemented a custom hook that retrieves past events. In order to do that, the component creates a "client" object to get logs from it:
import { localhost, hardhat } from 'viem/chains'
export const client = createPublicClient({
chain: hardhat,
transport: http()
})
export async function useGetEvent(_contract:address, _evt, _lotteryNum:number|bigint, _depthFrom:number, _depthTo:bigint) {
const logs = await client.getLogs({
event: _evt,
address: _contract,
fromBlock: BigInt(_depthFrom),
toBlock: _depthTo,
args: {_lotteryID: BigInt(_lotteryNum)}
})
return(logs)
}
Could it depend on this one or shall I look into something else?
Steps To Reproduce
No response
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
No response
Never mind, probably a strong caching problem somehow solved by switching to Rabby, getting the error message there that Rabby doesn't support hardhat network, then switching back to metamask. Now it autoconnects on refresh.