Fix flickering issues due to reconnecting loop
This commit is contained in:
@@ -361,6 +361,19 @@ final ticketsQueryProvider = StateProvider<TicketQuery>(
|
||||
(ref) => const TicketQuery(),
|
||||
);
|
||||
|
||||
/// Derived provider that selects a single [Ticket] by ID from the tickets list.
|
||||
///
|
||||
/// Because [Ticket] implements `==`, this provider only notifies watchers when
|
||||
/// the specific ticket's data actually changes — not when unrelated tickets in
|
||||
/// the list are updated. Use this in detail screens to avoid full-list rebuilds.
|
||||
final ticketByIdProvider = Provider.family<Ticket?, String>((ref, ticketId) {
|
||||
return ref
|
||||
.watch(ticketsProvider)
|
||||
.valueOrNull
|
||||
?.where((t) => t.id == ticketId)
|
||||
.firstOrNull;
|
||||
});
|
||||
|
||||
final ticketMessagesProvider =
|
||||
StreamProvider.family<List<TicketMessage>, String>((ref, ticketId) {
|
||||
final client = ref.watch(supabaseClientProvider);
|
||||
|
||||
Reference in New Issue
Block a user