fix: update loop, ghost queue item, briefing card scroll trap

- Update dialog no longer re-appears on every shell re-mount; check()
  is skipped if status is already available/upToDate/downloading
- Offline queue dequeue now happens before the mounted check, preventing
  ghost items when the widget disposes mid-drain
- Briefing digest card and messages now share a CustomScrollView so
  expanding the card doesn't trap the user without scroll access

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 08:23:24 -04:00
parent baba5c3462
commit 844f68d376
2 changed files with 56 additions and 37 deletions
+12 -6
View File
@@ -152,10 +152,14 @@ class _ShellState extends ConsumerState<_Shell> {
@override
void initState() {
super.initState();
// Silent update check on first app load.
// Silent update check — only if we haven't already checked this session.
// Skipping when status is not idle/error prevents the dialog from
// re-appearing every time the shell re-mounts (e.g. after visiting settings).
WidgetsBinding.instance.addPostFrameCallback((_) {
final repoUrl = ref.read(forgejoRepoUrlProvider);
if (repoUrl != null && repoUrl.isNotEmpty) {
if (repoUrl == null || repoUrl.isEmpty) return;
final status = ref.read(updateProvider).status;
if (status == UpdateStatus.idle || status == UpdateStatus.error) {
ref.read(updateProvider.notifier).check(repoUrl);
}
});
@@ -356,8 +360,10 @@ class _QuickCaptureBarState extends ConsumerState<_QuickCaptureBar> {
if (!mounted) break;
try {
final result = await api.capture(text);
if (!mounted) break;
// Dequeue before the mounted check — SharedPreferences doesn't need
// the widget alive, and skipping this would leave a ghost item.
await ref.read(captureQueueProvider.notifier).dequeue(text);
if (!mounted) break;
switch (result.type) {
case 'note':
ref.invalidate(notesProvider);
@@ -368,9 +374,9 @@ class _QuickCaptureBarState extends ConsumerState<_QuickCaptureBar> {
} on NetworkException {
break;
} catch (_) {
if (mounted) {
await ref.read(captureQueueProvider.notifier).dequeue(text);
}
// Server error or unexpected failure — drop from queue to prevent
// ghost items that can never be cleared.
await ref.read(captureQueueProvider.notifier).dequeue(text);
}
}
}