Fixed ghost channel subscription

This commit is contained in:
2026-03-01 20:31:13 +08:00
parent 029e671367
commit 3950f3ee94
3 changed files with 19 additions and 5 deletions
+4 -2
View File
@@ -261,7 +261,7 @@ final tasksProvider = StreamProvider<List<Task>>((ref) {
// ── Realtime stream ───────────────────────────────────────────────────────
// Processes every realtime event through the same isolate. Debounced so
// rapid consecutive events (e.g. bulk inserts) don't cause repeated renders.
wrapper.stream
final wrapperSub = wrapper.stream
.asyncMap((result) async {
final payload = _buildTaskPayload(
tasks: result.data,
@@ -286,10 +286,12 @@ final tasksProvider = StreamProvider<List<Task>>((ref) {
},
onError: (Object e) {
debugPrint('[tasksProvider] stream error: $e');
controller.addError(e);
// Don't forward errors — the wrapper handles recovery internally.
},
);
ref.onDispose(wrapperSub.cancel);
return controller.stream;
});