Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Update UI state immediately after comment deletion

ashilkn6c9ca0a5da4b
diff --git a/mobile/apps/photos/lib/ui/social/comments_screen.dart b/mobile/apps/photos/lib/ui/social/comments_screen.dart
index b944f3de2c..23599a69cb 100644
--- a/mobile/apps/photos/lib/ui/social/comments_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/comments_screen.dart
@@ -180,6 +180,12 @@ class _CommentsScreenState extends State<CommentsScreen> {
await SocialDataProvider.instance.addComment(newComment);
}
+ void _handleCommentDeleted(String commentId) {
+ setState(() {
+ _comments.removeWhere((c) => c.id == commentId);
+ });
+ }
+
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
@@ -246,6 +252,8 @@ class _CommentsScreenState extends State<CommentsScreen> {
_getReactionsForComment(comment.id),
onReplyTap: () => _onReplyTap(comment),
userResolver: _getUserForComment,
+ onCommentDeleted: () =>
+ _handleCommentDeleted(comment.id),
);
},
),