File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
packages/appkit/src/client Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -2357,12 +2357,15 @@ export abstract class AppKitBaseClient {
2357
2357
callback ( account )
2358
2358
}
2359
2359
2360
- if ( namespace ) {
2361
- ChainController . subscribeChainProp ( 'accountState' , updateVal , namespace )
2362
- } else {
2363
- ChainController . subscribe ( updateVal )
2360
+ const unsubscribeChain = namespace
2361
+ ? ChainController . subscribeChainProp ( 'accountState' , updateVal , namespace )
2362
+ : ChainController . subscribe ( updateVal )
2363
+ const unsubscribeConnector = ConnectorController . subscribe ( updateVal )
2364
+
2365
+ return ( ) => {
2366
+ unsubscribeChain ( )
2367
+ unsubscribeConnector ( )
2364
2368
}
2365
- ConnectorController . subscribe ( updateVal )
2366
2369
}
2367
2370
2368
2371
public subscribeNetwork (
@@ -2389,11 +2392,11 @@ export abstract class AppKitBaseClient {
2389
2392
}
2390
2393
2391
2394
public subscribeShouldUpdateToAddress ( callback : ( newState ?: string ) => void ) {
2392
- AccountController . subscribeKey ( 'shouldUpdateToAddress' , callback )
2395
+ return AccountController . subscribeKey ( 'shouldUpdateToAddress' , callback )
2393
2396
}
2394
2397
2395
2398
public subscribeCaipNetworkChange ( callback : ( newState ?: CaipNetwork ) => void ) {
2396
- ChainController . subscribeKey ( 'activeCaipNetwork' , callback )
2399
+ return ChainController . subscribeKey ( 'activeCaipNetwork' , callback )
2397
2400
}
2398
2401
2399
2402
public getState ( ) {
You can’t perform that action at this time.
0 commit comments