refactor: streamline conversation delta stream handling
- Replaced direct stream access in the `regenerateMessage` and `_sendMessageInternal` methods with a new helper function `_conversationDeltaStream` for better encapsulation and reusability. - Improved the management of chat and channel event streams by utilizing the new helper function, enhancing code clarity and maintainability. - Removed the previous `conversationDeltaEventsProvider` as it is no longer necessary with the new implementation, simplifying the provider structure.
This commit is contained in:
@@ -462,27 +462,8 @@ class ConversationDeltaStream extends _$ConversationDeltaStream {
|
||||
_socketSubscription?.dispose();
|
||||
_socketSubscription = null;
|
||||
}
|
||||
|
||||
/// Provides direct access to the underlying stream.
|
||||
/// Note: This getter is necessary for compatibility with StreamProvider.
|
||||
/// While Riverpod 3 discourages public getters on Notifiers, this is a
|
||||
/// pragmatic exception for stream delegation patterns.
|
||||
// ignore: avoid_public_notifier_properties
|
||||
Stream<ConversationDelta> get stream =>
|
||||
_controller?.stream ?? const Stream<ConversationDelta>.empty();
|
||||
}
|
||||
|
||||
final conversationDeltaEventsProvider =
|
||||
StreamProvider.family<ConversationDelta, ConversationDeltaRequest>((
|
||||
ref,
|
||||
request,
|
||||
) {
|
||||
final notifier = ref.watch(
|
||||
conversationDeltaStreamProvider(request).notifier,
|
||||
);
|
||||
return notifier.stream;
|
||||
});
|
||||
|
||||
// Attachment upload queue provider
|
||||
final attachmentUploadQueueProvider = Provider<AttachmentUploadQueue?>((ref) {
|
||||
final api = ref.watch(apiServiceProvider);
|
||||
|
||||
Reference in New Issue
Block a user