Ensure flags are set before connect/disconnect events (#3846)

This commit is contained in:
Jaco
2021-08-05 16:46:33 +02:00
committed by GitHub
parent 90a84baa52
commit 4ae4e4298c
2 changed files with 4 additions and 4 deletions
+2 -1
View File
@@ -2,12 +2,13 @@
## master
- **Important** The `ClassOf` alias for `createClass` has been removed, us `createClass` (with new generics) directly
- **Important** The `ClassOf` alias for `createClass` has been removed, use `createClass` (with new generics) directly
Changes:
- `createType<T = Codec>('...': K)` now returns `Codec` when `K` is not in the InterfaceRegistry, with `T` override
- Handle `BitSequence` in `PortableRegistry`
- Ensure API `isConnected` is set before connect/disconnect events are fired
- Move all static test support files into `@polkadot/types-support`
- Align static Metadata with latest Substrate, Polkadot & Kusama
- Adjust v14 Metadata definitions to latest version
+2 -3
View File
@@ -352,8 +352,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
}
#onProviderConnect = async (): Promise<void> => {
this.emit('connected');
this._isConnected.next(true);
this.emit('connected');
try {
const [hasMeta, cryptoReady] = await Promise.all([
@@ -382,10 +382,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
}
#onProviderDisconnect = (): void => {
this.emit('disconnected');
this._isConnected.next(false);
this._unsubscribeHealth();
this.emit('disconnected');
};
#onProviderError = (error: Error): void => {