web-sdk icon indicating copy to clipboard operation
web-sdk copied to clipboard

OnLogout & onError Portis event handlers not being called

Open FlorianML opened this issue 4 years ago • 1 comments

Working with integrating Portis into my company's app. I'm able to pull the account using the implementation below but having issues fully logging out. After calling await portis.logout() it resolves with success: true but it does not trigger the onLogout callback. Instead I get an error (attached below) which also does not get communicated to the onError callback.

Reviewing the network activity, there are still calls being made from the widget after the provider has logged out so I'm unsure if the previous issue has anything to do with it

Code Snippet:

const { Portis } = window;

export async function getPortisAddresses() {
  let portis = new Portis(process.env.REACT_APP_PORTIS_ID, 'mainnet');

  portis.onLogout(() => {
    if (isDev()) {
      // eslint-disable-next-line no-console
      console.log('logging out');
    }
  });
  portis.onError((error) => {
    if (isDev()) {
      // eslint-disable-next-line no-console
      console.log('error occured', error);
    }
  });

  const accounts = await portis.provider.enable();

  // deactivate portis
 await portis.logout();

  portis = undefined;
  return accounts;
}

Error: Screen Shot 2021-10-01 at 12 00 41 PM

FlorianML avatar Oct 01 '21 16:10 FlorianML

Having the same issue

fsobh avatar Mar 16 '22 20:03 fsobh