Merge pull request #1306 from Sanji78/master

Fix user profile is unavailable with PowerSync
This commit is contained in:
Roland Geider
2026-08-09 13:33:10 +02:00
committed by GitHub

View File

@@ -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));