1Hive/gardens-ui

Garden-ui app should not ask for switch network if not the active tab

Corantin opened this issue · 1 comments

Problem

Switch wallet network and Gardens-UI opened in another tab resulting in metamask asking us to switch network back to the one before.

Repro

  1. We change network in another chain (from gnosis to Rinkeby)
    image

  2. Gardens ask to switch network
    image

Suggestion

Only ask to chain network when Gardens-UI app is the active tab

Example in Quests : https://github.com/1Hive/quests/blob/main/packages/react-app/src/contexts/wallet.context.tsx#:~:text=%20!document.hidden%20%26%26

Yeah the #825 have the idea fix that, but its need some review to be approved.