From e01f243ae27182a1a775babe96b143cf394fa980 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 8 Sep 2021 14:52:41 +0200 Subject: [PATCH] emit reconnect event after being reconnected --- CHANGELOG.md | 4 ++++ README.md | 10 ---------- lib/src/protocols/abstract.dart | 5 +++-- pubspec.yaml | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5cebfc1..90dc06e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [3.0.1] + +- Bug fix: Fix a bug where the reconnect event would be emited before actually being reconnected + ## [3.0.0] - Sound null safety compat diff --git a/README.md b/README.md index 83035dbe..d64ac128 100644 --- a/README.md +++ b/README.md @@ -21,16 +21,6 @@ You can access the Kuzzle repository on [Github](https://github.com/kuzzleio/kuz * [Documentation and Samples](#documentation-and-samples) * [Contribution](#contribution) -## Installation - -Include this in your pubspec.yaml - -```yaml -dependencies: - kuzzle: ^3.0.0 - -``` - ## Documentation and Samples * [https://docs.kuzzle.io/sdk/dart/2/](https://docs.kuzzle.io/sdk/dart/2/) - diff --git a/lib/src/protocols/abstract.dart b/lib/src/protocols/abstract.dart index 6b65b1ae..0d0e5417 100644 --- a/lib/src/protocols/abstract.dart +++ b/lib/src/protocols/abstract.dart @@ -95,10 +95,11 @@ abstract class KuzzleProtocol extends KuzzleEventEmitter { return; } - emit(protocolState == KuzzleProtocolState.reconnecting + final protocolStateCpy = protocolState; + protocolState = KuzzleProtocolState.connected; + emit(protocolStateCpy == KuzzleProtocolState.reconnecting ? ProtocolEvents.RECONNECT : ProtocolEvents.CONNECT); - protocolState = KuzzleProtocolState.connected; } /// Called when the client's connection is closed diff --git a/pubspec.yaml b/pubspec.yaml index 9e8775a0..d4841c3b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: kuzzle -version: 3.0.0 +version: 3.0.1 description: A library to interact with kuzzle API. A backend software, self-hostable and ready to use to power modern cross-platform apps. homepage: https://github.com/kuzzleio/sdk-dart