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
@@ -256,7 +256,7 @@ final ticketsProvider = StreamProvider<List<Ticket>>((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 = _buildTicketPayload(
tickets: result.data,
@@ -280,10 +280,12 @@ final ticketsProvider = StreamProvider<List<Ticket>>((ref) {
},
onError: (Object e) {
debugPrint('[ticketsProvider] stream error: $e');
controller.addError(e);
// Don't forward errors — the wrapper handles recovery internally.
},
);
ref.onDispose(wrapperSub.cancel);
return controller.stream;
});