fix(ui): never hang on a blank frame when the hub is unreachable

main() awaited the hub health probe before runApp(); a gRPC-web
error out of HubRepository.connect propagated and left the app on a
white page. Guard the settings+probe in main() with a MockRepository
fallback so the first frame always paints.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-06-19 02:25:39 +02:00
parent 136d3b48c6
commit 9dfa418e92

View file

@ -9,8 +9,22 @@ import 'theme/reclaim_theme.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final settings = await HubSettings.load(); // Acquiring settings + probing the hub must never prevent the
final repository = await _pickRepository(settings); // first frame. Any failure here falls back to demo data so the
// app always paints instead of hanging on a blank page.
HubSettings settings;
EvaluationRepository repository;
try {
settings = await HubSettings.load();
repository = await _pickRepository(settings);
} catch (_) {
settings = const HubSettings(
host: HubSettings.defaultHost,
port: HubSettings.defaultPort,
secure: false,
);
repository = const MockRepository();
}
runApp(ReclaimApp(repository: repository, settings: settings)); runApp(ReclaimApp(repository: repository, settings: settings));
} }