diff --git a/lib/pages/audit.dart b/lib/pages/audit.dart index ce454a3..d9e7645 100644 --- a/lib/pages/audit.dart +++ b/lib/pages/audit.dart @@ -81,6 +81,7 @@ class _AuditPageState extends State { /// filtering, and the hash-chain ordering exactly as before. StreamSubscription? _eventSub; Timer? _nudgeDebounce; + Timer? _reconnect; @override void initState() { @@ -97,6 +98,7 @@ class _AuditPageState extends State { Workspace.instance.removeListener(_onWorkspaceChanged); _poller?.cancel(); _nudgeDebounce?.cancel(); + _reconnect?.cancel(); _eventSub?.cancel(); super.dispose(); } @@ -122,7 +124,12 @@ class _AuditPageState extends State { onDone: () { _eventSub = null; if (mounted) { - Timer(const Duration(seconds: 3), () { + // Held in a field so dispose() can cancel it — an + // anonymous timer here outlives the page when the + // stream closes right before navigation (the a11y + // suite caught this as a pending-timer flake). + _reconnect?.cancel(); + _reconnect = Timer(const Duration(seconds: 3), () { if (mounted && _eventSub == null) _subscribeLive(); }); }