Closed jahabeebs closed 2 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
od-app | ✅ Ready (Inspect) | Visit Preview | Jul 19, 2024 9:59pm |
od-app-hai | ✅ Ready (Inspect) | Visit Preview | Jul 19, 2024 9:59pm |
od-app-testnet | ✅ Ready (Inspect) | Visit Preview | Jul 19, 2024 9:59pm |
@pi0neerpat
The reason this PR was causing more of the onboarding components to flash on the screen was because I got rid of a fetch call that was unnecessary and was only causing the final component to take longer to load (preventing flashing from intermediate components), so I added the following logic:
I added a useEffect in Vaults/index.tsx that checks if the user's wallet is already connected (if there is a wallet address and token info) and if so we add a slight loading buffer of 1 second in which the intermediary components load before setting loading to false
If geb is set but there's no account set (meaning we've connected to an RPC via the app's settings) then we can connect immediately and there's no intermediary flashing
No wallet connected, load immediately
https://github.com/user-attachments/assets/3cd6f4b4-1fde-4c72-8bd0-4ec8694435e8
Wallet connected, 1 sec buffer to prevent component flashes
https://github.com/user-attachments/assets/2a7c06d8-644e-4737-9471-e3832cb9f7e1
closes #642
Description
There was a line "if !(window.ethereum)" which was basically blocking the browser wallet from being able to reconnect automatically
I added a fallback that will load the image after 3 seconds if loading isn't set to true
By removing connector from the dependency array in WalletConnectV2Card we prevent an infinite loop from occurring that would prevent wallet connect from giving up its connection. Now we switch providers even if we're connected with wallet connect. The only issue remains that wallet connect doesn't realize when the websocket connection has been terminated and it'll still show that the user is connected.
In Vaults/index.tsx we had a setInterval that was fetching the user's vaults every 3000 ms. This was causing excessive re-renders and is totally unnecessary because we already have the useSafeData hook that's refetching that data anyway
Screenshots
Autoconnect wallet on refresh
https://github.com/user-attachments/assets/68a6caf9-9f3a-4b0e-80e6-6f20d1eba929
Fallback if loading skeleton isn't disappearing
https://github.com/user-attachments/assets/a81fe3b3-fc0c-4f33-982f-f8655e98ab4b
User can switch from wallet connect to MetaMask
https://github.com/user-attachments/assets/a983c03b-1ef0-4cfa-a0a8-ae7de4235250