mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-29 09:11:17 +01:00
fix(local-network): don't let a pre-Settings probe repopulate the cache
invalidate() cleared the cached status but did nothing about a probe already in flight. That probe then completed and wrote its answer back — the answer from before whatever prompted the invalidation. The case that matters is the one invalidate() exists for: the user is told Local Network is off, taps through to System Settings, grants it and comes back. If a probe was in flight when they left, its stale "denied" lands afterwards and becomes the cached truth, so the app still claims the permission is off. Tag each probe with a generation, bump it in invalidate(), and only write the cache when the generation is still current. Whoever is awaiting the stale probe still gets its result — it just doesn't become the shared answer. invalidate() also drops _inFlight now, so the next caller starts a fresh probe instead of being handed the pre-invalidation one. Found while chasing an intermittent test failure. That turned out to be an unrelated ambient issue (a MissingPluginException on the app_links EventChannel that attaches to whichever test is in flight, which already fails ten other files), but the race it exposed here was real. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,8 @@ import 'dart:io';
|
||||
|
||||
import 'package:bike_control/gen/l10n.dart';
|
||||
import 'package:bike_control/main.dart' show screenshotMode;
|
||||
import 'package:bike_control/services/local_network_access.dart';
|
||||
import 'package:bike_control/bluetooth/emulation/emulated_ble_platform.dart';
|
||||
import 'package:bike_control/services/local_network_access.dart';
|
||||
import 'package:bike_control/utils/core.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
Reference in New Issue
Block a user