diff --git a/src/App.js b/src/App.js index b590e08d69..695b12889a 100644 --- a/src/App.js +++ b/src/App.js @@ -7,11 +7,6 @@ function App() { const openModal = () => { p.onConnect() } - const clearLocalStorage = () => { - localStorage.clear() - document.getElementById('accounts').innerHTML = '' - document.getElementById('chain').innerHTML = '' - } p.internalEvents.on('accountsChanged', (accounts) => { document.getElementById('accounts').innerHTML = JSON.stringify(accounts) }) @@ -19,11 +14,15 @@ function App() { p.internalEvents.on('chainChanged', (chain) => { document.getElementById('chain').innerHTML = chain }) + + p.internalEvents.on('disconnect', (chain) => { + document.getElementById('accounts').innerHTML = '' + document.getElementById('chain').innerHTML = '' + }) return (
-
diff --git a/src/RemixClient.js b/src/RemixClient.js index d285397635..e13aeb14a6 100644 --- a/src/RemixClient.js +++ b/src/RemixClient.js @@ -65,6 +65,11 @@ export class RemixClient extends PluginClient { this.provider.on("networkChanged", (networkId) => { this.internalEvents.emit('networkChanged', networkId) }); + + // Subscribe to networkId change + this.provider.on("disconnect", () => { + this.internalEvents.emit('disconnect') + }); } getProviderOptions () {