diff --git a/apps/app_seeds/lib/di/injector.dart b/apps/app_seeds/lib/di/injector.dart index 2cffc8d..4d45472 100644 --- a/apps/app_seeds/lib/di/injector.dart +++ b/apps/app_seeds/lib/di/injector.dart @@ -41,7 +41,14 @@ final GetIt getIt = GetIt.instance; /// Wires the encrypted DB, keystore and repositories. Call once from `main` /// before `runApp`; the DB key must exist before the DB opens. +/// +/// Idempotent: a hot restart (or an Android Activity restart that keeps the +/// isolate) re-runs `main` while GetIt still holds the singletons. Without this +/// guard the re-registration throws, `main` aborts before rebuilding `TaneApp` +/// with the social layer, and the app falls back to the "inventory only" look. Future configureDependencies() async { + if (getIt.isRegistered()) return; + final secretStore = FlutterSecretStore(); final keyStore = SecureKeyStore(store: secretStore); final dbKeyHex = await keyStore.databaseKeyHex();