Offline Support
This commit is contained in:
@@ -423,10 +423,15 @@ class _ItJobTileState extends ConsumerState<_ItJobTile> {
|
||||
// The realtime stream may arrive with a slight delay; clearing here
|
||||
// causes a visible revert flash before the stream catches up.
|
||||
} catch (e) {
|
||||
// Revert optimistic state on failure only
|
||||
if (mounted) {
|
||||
setState(() => _optimisticChecked = !val);
|
||||
showErrorSnackBar(context, 'Failed to update: $e');
|
||||
if (isOfflineSaveError(e)) {
|
||||
// Brick queued the write — keep optimistic state, just notify user
|
||||
showSuccessSnackBar(context, 'Saved offline — will sync when connected.');
|
||||
} else {
|
||||
// Revert optimistic state on real failure
|
||||
setState(() => _optimisticChecked = !val);
|
||||
showErrorSnackBar(context, 'Failed to update: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user