fix: surface sync errors via snackbar instead of silently swallowing them
The sync button used a fire-and-forget lambda — any exception from syncEmails was discarded with no feedback. Now it awaits the call and shows a snackbar on failure, making errors visible in the UI and in tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
8a51496181
commit
d3646e350b
@@ -133,8 +133,19 @@ class _EmailListScreenState extends ConsumerState<EmailListScreen> {
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.sync),
|
||||
onPressed: () =>
|
||||
emailRepo.syncEmails(widget.accountId, widget.mailboxPath),
|
||||
onPressed: () async {
|
||||
try {
|
||||
await emailRepo.syncEmails(
|
||||
widget.accountId,
|
||||
widget.mailboxPath,
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Sync failed: $e')),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
|
||||
Reference in New Issue
Block a user