Skip to content

Commit 2899871

Browse files
committed
feat(bootstrap): fetch initial user for AppBloc authentication status
- Add code to fetch the initial user from the authentication repository - Ensure the AppBloc starts with an accurate authentication status - Update bootstrap function to pass the initial user to the AppBloc
1 parent 785a7af commit 2899871

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/bootstrap.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ Future<Widget> bootstrap(
7373
);
7474
}
7575

76+
// Fetch the initial user from the authentication repository.
77+
// This ensures the AppBloc starts with an accurate authentication status.
78+
final initialUser = await authenticationRepository.getCurrentUser();
79+
7680
// Conditional data client instantiation based on environment
7781
DataClient<Headline> headlinesClient;
7882
DataClient<Topic> topicsClient;
@@ -289,5 +293,6 @@ Future<Widget> bootstrap(
289293
environment: environment,
290294
demoDataMigrationService: demoDataMigrationService,
291295
adService: adService,
296+
initialUser: initialUser,
292297
);
293298
}

0 commit comments

Comments
 (0)