Fix flickering issues due to reconnecting loop
This commit is contained in:
@@ -526,6 +526,30 @@ List<Map<String, dynamic>> _processTasksInIsolate(
|
||||
/// Provider for task query parameters.
|
||||
final tasksQueryProvider = StateProvider<TaskQuery>((ref) => const TaskQuery());
|
||||
|
||||
/// Derived provider that selects a single [Task] by ID from the tasks list.
|
||||
///
|
||||
/// Because [Task] implements `==`, this provider only notifies watchers when
|
||||
/// the specific task's data actually changes — not when unrelated tasks in the
|
||||
/// list are updated. Use this in detail screens to avoid full-list rebuilds.
|
||||
final taskByIdProvider = Provider.family<Task?, String>((ref, taskId) {
|
||||
return ref
|
||||
.watch(tasksProvider)
|
||||
.valueOrNull
|
||||
?.where((t) => t.id == taskId)
|
||||
.firstOrNull;
|
||||
});
|
||||
|
||||
/// Derived provider that selects a [Task] linked to a given ticket ID.
|
||||
///
|
||||
/// Returns the first task whose `ticketId` matches [ticketId], or null.
|
||||
final taskByTicketIdProvider = Provider.family<Task?, String>((ref, ticketId) {
|
||||
return ref
|
||||
.watch(tasksProvider)
|
||||
.valueOrNull
|
||||
?.where((t) => t.ticketId == ticketId)
|
||||
.firstOrNull;
|
||||
});
|
||||
|
||||
final taskAssignmentsProvider = StreamProvider<List<TaskAssignment>>((ref) {
|
||||
final client = ref.watch(supabaseClientProvider);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user