onReplyUpdated method

void onReplyUpdated(
  1. CommentData reply
)

Handles the update of an existing comment reply.

Implementation

void onReplyUpdated(CommentData reply) {
  // Update nested replies (handles both top-level and nested replies)
  final updatedReplies = state.replies.updateNested(
    (it) => it.id == reply.id,
    children: (it) => it.replies ?? [],
    update: (found) => found.updateWith(reply),
    updateChildren: (parent, replies) => parent.copyWith(replies: replies),
    compare: commentSort.compare,
  );

  state = state.copyWith(replies: updatedReplies);
}