From 19bcbc7bc5a55168e1e81ec5df5ddd86ee7c9a3d Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 19 Apr 2021 19:01:15 +0530 Subject: [PATCH] fix(llc): `queryChannels` should only throw if we do-not have any channels in cache (#394) * fix(llc): queryChannel should throw exception if client is not yet connected Signed-off-by: Sahil Kumar * prepare llc for v1.5.2 Signed-off-by: Sahil Kumar * fix queryChannelOnline invocation conditions Signed-off-by: Sahil Kumar * fix package version Signed-off-by: Sahil Kumar * queryChannels should only throw if we do-not have any channels in cache Signed-off-by: Sahil Kumar * update changelog with the correct fix Signed-off-by: Sahil Kumar --- packages/stream_chat/CHANGELOG.md | 4 ++++ packages/stream_chat/lib/src/client.dart | 4 +++- packages/stream_chat/lib/version.dart | 2 +- packages/stream_chat/pubspec.yaml | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 87000dc4..c95091b4 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.5.2 + +- fix: `queryChannels` should throw exceptions only if no data is present in cache. + ## 1.5.1 - Minor fixes and improvements diff --git a/packages/stream_chat/lib/src/client.dart b/packages/stream_chat/lib/src/client.dart index 8b9d3a75..657fb113 100644 --- a/packages/stream_chat/lib/src/client.dart +++ b/packages/stream_chat/lib/src/client.dart @@ -633,7 +633,7 @@ class StreamChatClient { ); if (channels.isNotEmpty) yield channels; - if (wsConnectionStatus == ConnectionStatus.connected) { + try { final newQueryChannelsFuture = queryChannelsOnline( filter: filter, sort: sort, @@ -648,6 +648,8 @@ class StreamChatClient { _queryChannelsStreams[hash] = newQueryChannelsFuture; yield await newQueryChannelsFuture; + } catch (_) { + if (channels.isEmpty) rethrow; } } } diff --git a/packages/stream_chat/lib/version.dart b/packages/stream_chat/lib/version.dart index 4d12add5..948ae1df 100644 --- a/packages/stream_chat/lib/version.dart +++ b/packages/stream_chat/lib/version.dart @@ -3,4 +3,4 @@ import 'package:stream_chat/src/client.dart'; /// Current package version /// Used in [StreamChatClient] to build the `x-stream-client` header // ignore: constant_identifier_names -const PACKAGE_VERSION = '1.5.1'; +const PACKAGE_VERSION = '1.5.2'; diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 24298ae1..b32bdf43 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat homepage: https://getstream.io/ description: The official Dart client for Stream Chat, a service for building chat applications. -version: 1.5.1 +version: 1.5.2 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues