safe-apps-sdk icon indicating copy to clipboard operation
safe-apps-sdk copied to clipboard

SafeAppConnector from `@gnosis.pm/safe-apps-web3-react` provides outdated data

Open shoom3301 opened this issue 1 year ago • 1 comments

Description

import { SafeAppConnector } from '@gnosis.pm/safe-apps-web3-react'

We are using it as connector.getSafeInfo() and got a problem. When we change an account in the wallet it keeps returning old data. For example, I connected as the owner of Safe and I'm not in readonly mode, then I switch to another account which is readonly, and getSafeInfo() return the old data that says I'm not readonly.

Environment

  • Browser: Chrome
  • Wallet: MetaMask
  • Chain: Rinkeby

Steps to reproduce

  1. Open https://gnosis-safe.io and connect an account that is owner of Safe
  2. Open the app in https://gnosis-safe.io
  3. Switch to another account in the wallet that is not the owner of Safe
  4. Request connector.getSafeInfo() from the app side

Expected result

connector.getSafeInfo() returned isReadOnly equals false

Obtained result

connector.getSafeInfo() returned isReadOnly equals true

Screenshots

shoom3301 avatar Aug 03 '22 14:08 shoom3301

The problem is the cached safeInfo: https://github.com/safe-global/safe-apps-sdk/blob/master/packages/safe-apps-web3-react/src/connector.ts#L25-L30

We need to update and release a new version of the SDK

mmv08 avatar Aug 03 '22 15:08 mmv08

Unexpected plot twist: we deprecated the web3-react connector because it's now available in the original web3-react package: https://github.com/Uniswap/web3-react

mmv08 avatar Oct 10 '22 11:10 mmv08