mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-02 10:09:11 +01:00
Merge pull request #1306 from Sanji78/master
Fix user profile is unavailable with PowerSync
This commit is contained in:
@@ -84,9 +84,12 @@ class DashboardWeightWidget extends ConsumerWidget {
|
||||
}
|
||||
final profile = profileAsync.value;
|
||||
if (profile == null) {
|
||||
// Loaded successfully but the API returned no profile, treat the same
|
||||
// way we treat a server error so the user isn't stuck on a spinner.
|
||||
return _shell(context, const StreamErrorIndicator('User profile is unavailable'));
|
||||
// The profile stream can legitimately emit null right after login,
|
||||
// before the local `user_profile` PowerSync bucket has finished its
|
||||
// first sync (see WeightOverview / NutritionalPlansList, which treat
|
||||
// this the same way). Keep showing the spinner instead of a
|
||||
// permanent-looking error; the widget rebuilds once the row lands.
|
||||
return _shell(context, const BoxedProgressIndicator());
|
||||
}
|
||||
|
||||
return _shell(context, _buildContent(context, entriesAsync.value!, profile));
|
||||
|
||||
Reference in New Issue
Block a user