fix(core): only handle the channel list event if the state is success.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
## Upcoming
|
||||||
|
|
||||||
|
- [#1269](https://github.com/GetStream/stream-chat-flutter/issues/1269)
|
||||||
|
Fix `ChannelListEventHandler` castError at PagedValue.asSuccess.
|
||||||
|
|
||||||
## 4.4.1
|
## 4.4.1
|
||||||
|
|
||||||
- Updated `stream_chat` dependency to [`4.4.1`](https://pub.dev/packages/stream_chat/changelog).
|
- Updated `stream_chat` dependency to [`4.4.1`](https://pub.dev/packages/stream_chat/changelog).
|
||||||
@@ -16,8 +21,10 @@
|
|||||||
|
|
||||||
🔄 Changed
|
🔄 Changed
|
||||||
|
|
||||||
- Deprecated `before` and `after` parameters in `StreamChannel.queryAroundMessage`. Use `limit` instead.
|
- Deprecated `before` and `after` parameters in `StreamChannel.queryAroundMessage`. Use `limit`
|
||||||
- Deprecated `before` and `after` parameters in `StreamChannel.loadChannelAtMessage`. Use `limit` instead.
|
instead.
|
||||||
|
- Deprecated `before` and `after` parameters in `StreamChannel.loadChannelAtMessage`. Use `limit`
|
||||||
|
instead.
|
||||||
|
|
||||||
## 4.1.0
|
## 4.1.0
|
||||||
|
|
||||||
@@ -30,14 +37,17 @@
|
|||||||
|
|
||||||
## 4.0.0
|
## 4.0.0
|
||||||
|
|
||||||
For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_4_0/)
|
For upgrading to V4, please refer to
|
||||||
|
the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_4_0/)
|
||||||
|
|
||||||
- Deprecated `UsersBloc` in favor of `StreamUserListController` to control the user list.
|
- Deprecated `UsersBloc` in favor of `StreamUserListController` to control the user list.
|
||||||
- Deprecated `MessageSearchBloc` in favor of `StreamMessageSearchListController` to control the user list.
|
- Deprecated `MessageSearchBloc` in favor of `StreamMessageSearchListController` to control the user
|
||||||
|
list.
|
||||||
|
|
||||||
## 4.0.0-beta.2
|
## 4.0.0-beta.2
|
||||||
|
|
||||||
- Updated `stream_chat` dependency to [`4.0.0-beta.2`](https://pub.dev/packages/stream_chat/changelog).
|
- Updated `stream_chat` dependency
|
||||||
|
to [`4.0.0-beta.2`](https://pub.dev/packages/stream_chat/changelog).
|
||||||
|
|
||||||
## 4.0.0-beta.0
|
## 4.0.0-beta.0
|
||||||
|
|
||||||
@@ -48,7 +58,8 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.
|
|||||||
- Deprecated `ChannelsBloc` in favor of `StreamChannelListController` to control the channel list.
|
- Deprecated `ChannelsBloc` in favor of `StreamChannelListController` to control the channel list.
|
||||||
- Added `MessageTextFieldController` to be used with the new `StreamTextField` ui widget.
|
- Added `MessageTextFieldController` to be used with the new `StreamTextField` ui widget.
|
||||||
|
|
||||||
- Updated `stream_chat` dependency to [`4.0.0-beta.0`](https://pub.dev/packages/stream_chat/changelog).
|
- Updated `stream_chat` dependency
|
||||||
|
to [`4.0.0-beta.0`](https://pub.dev/packages/stream_chat/changelog).
|
||||||
|
|
||||||
## 3.6.1
|
## 3.6.1
|
||||||
|
|
||||||
@@ -67,12 +78,14 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.
|
|||||||
- Updated `stream_chat` dependency to [`3.5.0`](https://pub.dev/packages/stream_chat/changelog).
|
- Updated `stream_chat` dependency to [`3.5.0`](https://pub.dev/packages/stream_chat/changelog).
|
||||||
|
|
||||||
## 3.4.0
|
## 3.4.0
|
||||||
|
|
||||||
- Updated `stream_chat` dependency to [`3.4.0`](https://pub.dev/packages/stream_chat/changelog).
|
- Updated `stream_chat` dependency to [`3.4.0`](https://pub.dev/packages/stream_chat/changelog).
|
||||||
|
|
||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
- Do not move a channel to top if the new message is from a thread.
|
- Do not move a channel to top if the new message is from a thread.
|
||||||
- [[#848]](https://github.com/GetStream/stream-chat-flutter/issues/848) Fixed "Bad state: Cannot add new events after calling close" by replacing all `.add` methods with a new `.safeAdd`.
|
- [[#848]](https://github.com/GetStream/stream-chat-flutter/issues/848) Fixed "Bad state: Cannot add
|
||||||
|
new events after calling close" by replacing all `.add` methods with a new `.safeAdd`.
|
||||||
|
|
||||||
## 3.3.1
|
## 3.3.1
|
||||||
|
|
||||||
@@ -133,8 +146,8 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.
|
|||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
- Fixed `MessageSearchBloc` pagination.
|
- Fixed `MessageSearchBloc` pagination.
|
||||||
- [[#673]](https://github.com/GetStream/stream-chat-flutter/issues/673): Fix `Core Widgets` not getting rebuild with new
|
- [[#673]](https://github.com/GetStream/stream-chat-flutter/issues/673): Fix `Core Widgets` not
|
||||||
data on configuration change.
|
getting rebuild with new data on configuration change.
|
||||||
|
|
||||||
## 2.2.1
|
## 2.2.1
|
||||||
|
|
||||||
@@ -152,8 +165,8 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.
|
|||||||
|
|
||||||
🐞 Fixed
|
🐞 Fixed
|
||||||
|
|
||||||
- [#612](https://github.com/GetStream/stream-chat-flutter/issues/612) `ChannelListView` pagination doesn't work after
|
- [#612](https://github.com/GetStream/stream-chat-flutter/issues/612) `ChannelListView` pagination
|
||||||
refresh
|
doesn't work after refresh
|
||||||
|
|
||||||
## 2.1.1
|
## 2.1.1
|
||||||
|
|
||||||
@@ -171,20 +184,23 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.
|
|||||||
|
|
||||||
🔄 Changed
|
🔄 Changed
|
||||||
|
|
||||||
- `StreamChatCore.of(context).user` is now deprecated in favor of `StreamChatCore.of(context).currentUser`.
|
- `StreamChatCore.of(context).user` is now deprecated in favor
|
||||||
- `StreamChatCore.of(context).userStream` is now deprecated in favor of `StreamChatCore.of(context).currentUserStream`.
|
of `StreamChatCore.of(context).currentUser`.
|
||||||
|
- `StreamChatCore.of(context).userStream` is now deprecated in favor
|
||||||
|
of `StreamChatCore.of(context).currentUserStream`.
|
||||||
|
|
||||||
## 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
🛑️ Breaking Changes from `1.5.3`
|
🛑️ Breaking Changes from `1.5.3`
|
||||||
|
|
||||||
- migrate this package to null safety
|
- migrate this package to null safety
|
||||||
- `channelsBloc.queryChannels()`, `ChannelListCore` options param/property is removed in favor of individual
|
- `channelsBloc.queryChannels()`, `ChannelListCore` options param/property is removed in favor of
|
||||||
params/properties
|
individual params/properties
|
||||||
- `options.state` -> bool state
|
- `options.state` -> bool state
|
||||||
- `options.watch` -> bool watch
|
- `options.watch` -> bool watch
|
||||||
- `options.presence` -> bool presence
|
- `options.presence` -> bool presence
|
||||||
- `usersBloc.queryUsers()`, `UserListCore` options param/property is removed in favor of individual params/properties
|
- `usersBloc.queryUsers()`, `UserListCore` options param/property is removed in favor of individual
|
||||||
|
params/properties
|
||||||
- `options.presence` -> bool presence
|
- `options.presence` -> bool presence
|
||||||
|
|
||||||
✅ Added
|
✅ Added
|
||||||
@@ -204,12 +220,13 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.
|
|||||||
|
|
||||||
🛑️ Breaking Changes from `2.0.0-nullsafety.7`
|
🛑️ Breaking Changes from `2.0.0-nullsafety.7`
|
||||||
|
|
||||||
- `channelsBloc.queryChannels()`, `ChannelListCore` options param/property is removed in favor of individual
|
- `channelsBloc.queryChannels()`, `ChannelListCore` options param/property is removed in favor of
|
||||||
params/properties
|
individual params/properties
|
||||||
- `options.state` -> bool state
|
- `options.state` -> bool state
|
||||||
- `options.watch` -> bool watch
|
- `options.watch` -> bool watch
|
||||||
- `options.presence` -> bool presence
|
- `options.presence` -> bool presence
|
||||||
- `usersBloc.queryUsers()`, `UserListCore` options param/property is removed in favor of individual params/properties
|
- `usersBloc.queryUsers()`, `UserListCore` options param/property is removed in favor of individual
|
||||||
|
params/properties
|
||||||
- `options.presence` -> bool presence
|
- `options.presence` -> bool presence
|
||||||
|
|
||||||
## 2.0.0-nullsafety.7
|
## 2.0.0-nullsafety.7
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ abstract class PagedValue<Key, Value> with _$PagedValue<Key, Value> {
|
|||||||
/// Returns `true` if the [PagedValue] is [Success].
|
/// Returns `true` if the [PagedValue] is [Success].
|
||||||
bool get isSuccess => this is Success<Key, Value>;
|
bool get isSuccess => this is Success<Key, Value>;
|
||||||
|
|
||||||
|
/// Returns `true` if the [PagedValue] is not [Success].
|
||||||
|
bool get isNotSuccess => !isSuccess;
|
||||||
|
|
||||||
/// Returns the [PagedValue] as [Success].
|
/// Returns the [PagedValue] as [Success].
|
||||||
Success<Key, Value> get asSuccess {
|
Success<Key, Value> get asSuccess {
|
||||||
assert(
|
assert(
|
||||||
|
|||||||
@@ -223,6 +223,9 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
|
|||||||
client.on().skip(1) // Skipping the last emitted event.
|
client.on().skip(1) // Skipping the last emitted event.
|
||||||
// We only need to handle the latest events.
|
// We only need to handle the latest events.
|
||||||
.listen((event) {
|
.listen((event) {
|
||||||
|
// Only handle the event if the value is in success state.
|
||||||
|
if (value.isNotSuccess) return;
|
||||||
|
|
||||||
// Returns early if the event is already handled by the listener.
|
// Returns early if the event is already handled by the listener.
|
||||||
if (eventListener?.call(event) ?? false) return;
|
if (eventListener?.call(event) ?? false) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user