Fix bootstrap bug

This commit is contained in:
problematicconsumer
2023-11-12 21:55:17 +03:30
parent 344f4f706f
commit 577bb3ded3
4 changed files with 29 additions and 32 deletions

View File

@@ -90,8 +90,9 @@ class ConnectivityController extends _$ConnectivityController with AppLogger {
final activeProfile = await ref.read(activeProfileProvider.future);
await _core
.start(activeProfile!.id, ref.read(disableMemoryLimitProvider))
.mapLeft((err) {
loggy.warning("error connecting $err", err);
.mapLeft((err) async {
loggy.warning("error connecting", err);
await ref.read(startedByUserProvider.notifier).update(false);
state = AsyncError(err, StackTrace.current);
}).run();
}

View File

@@ -31,7 +31,7 @@ class WindowController extends _$WindowController
await windowManager.hide();
}
await Future.delayed(
const Duration(seconds: 1),
const Duration(seconds: 3),
() async {
if (ref.read(startedByUserProvider)) {
loggy.debug("previously started by user, trying to connect");

View File

@@ -30,7 +30,10 @@ class SystemTrayController extends _$SystemTrayController
_initialized = true;
}
final connection = await ref.watch(connectivityControllerProvider.future);
final connection = switch (ref.watch(connectivityControllerProvider)) {
AsyncData(:final value) => value,
_ => const Disconnected(),
};
final serviceMode = ref.watch(serviceModeStoreProvider);
final t = ref.watch(translationsProvider);