You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a React hook I was working on when I noticed the issue. I tried with another dapp using IDX and it has the same behaviour.
I think that you can reproduce this if you go on https://self.id/ and login with an Ethereum address, then go to your Metamask and switch to another address that has another did, your basic profile name won't update unless you refresh the page.
Logged in with address 1:
Switched to other address:
Expected behaviour(it works if I reload the page):
declareconstwindow: any;import{useEffect,useMemo,useState}from"react";import{EthereumAuthProvider,SelfID,WebClient}from"@self.id/web";importpublishedModelfrom"@d-profiles/schemas/lib/model.json";import{CERAMIC_TESTNET}from".";importWeb3from"web3";importWeb3Modalfrom"web3modal";importWalletConnectProviderfrom"@walletconnect/web3-provider";import{useEthers}from"@usedapp/core";exportconstuseSelf=()=>{const{ account }=useEthers();const[mySelf,setMySelf]=useState<SelfID>();const[basicProfile,setBasicProfile]=useState<any|null>();const[address,setAddress]=useState<string|undefined>();const[error,setError]=useState<unknown>();const[isLoading,setIsLoading]=useState(false);useEffect(()=>{(async()=>{try{console.log("Account changed",account)setIsLoading(true);constproviderOptions={// Example with injected providersinjected: {display: {// logo: "data:image/gif;base64,INSERT_BASE64_STRING",name: "Injected",description: "Connect with the provider in your Browser",},package: null,},};constweb3Modal=newWeb3Modal({network: "mainnet",// optionalcacheProvider: false,// optional
providerOptions,// required});constprovider=awaitweb3Modal.connect();console.log({ provider });constweb3=newWeb3(provider);await(web3?.currentProviderasany).enable();// The following configuration assumes your local node is connected to the Clay testnetconstclient=newWebClient({ceramic: CERAMIC_TESTNET,connectNetwork: CERAMIC_TESTNET,model: publishedModel,});if(account){console.log("my account",account);constauthProvider=newEthereumAuthProvider(window.ethereum,account);// If authentication is successful, a DID instance is returnedconstdid=awaitclient.authenticate(authProvider);console.log("my did",{did: did.id.toString()});// A SelfID instance can only be created with an authenticated DIDconstself=newSelfID({ client, did });constbp=awaitself.get("basicProfile");console.log({ bp });setMySelf(self);setBasicProfile(bp);setIsLoading(false);}}catch(error){setError(error);setIsLoading(false);}})();},[account]);return{self: mySelf, basicProfile, error, isLoading };};
The text was updated successfully, but these errors were encountered:
@Cali93 can you reproduce the issue using 3ID Connect directly (not Self.ID) please?
Self.ID might not be using the latest version of 3ID Connect so that might be part of the problem. Thanks!
This is a React hook I was working on when I noticed the issue. I tried with another dapp using IDX and it has the same behaviour.
I think that you can reproduce this if you go on https://self.id/ and login with an Ethereum address, then go to your Metamask and switch to another address that has another did, your basic profile name won't update unless you refresh the page.
Logged in with address 1:
![First account](https://user-images.githubusercontent.com/32299095/137794478-03ce90f2-ce92-4c22-b137-7f23b330b8cd.png)
![Capture d’écran 2021-10-18 212548](https://user-images.githubusercontent.com/32299095/137794643-a122e167-1fec-4c3d-919f-29b109fafc25.png)
![Capture d’écran 2021-10-18 212738](https://user-images.githubusercontent.com/32299095/137794720-37a6d09d-e100-4600-bc72-1c21dac2e92d.png)
Switched to other address:
Expected behaviour(it works if I reload the page):
The text was updated successfully, but these errors were encountered: