Skip to content

Commit 2cfa1b7

Browse files
author
Luis Güette
committed
Update comments when updating reactions
1 parent 6070129 commit 2cfa1b7

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/Livewire/Comment.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,7 @@ public function toggleReaction(string $reactionType)
128128
]);
129129
}
130130

131-
// Reload the comment with updated reactions relationship count/data
132-
// Livewire might handle this automatically if the comment object is updated,
133-
// but explicitly reloading might be necessary depending on how data is passed/managed.
134-
$this->comment->load('reactions'); // Or $this->comment->loadCount('reactions');
135-
136-
// We might need to explicitly re-render or notify the parent list if counts are displayed there.
137-
// $this->dispatch('comment:reactions-updated', commentId: $this->comment->id); // Example dispatch
131+
$this->dispatch('comment:reactions-updated');
138132
}
139133

140134
#[Computed]

src/Livewire/CommentList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function comments(): Collection
3131
#[On('comment:saved')]
3232
#[On('comment:updated')]
3333
#[On('comment:deleted')]
34+
#[On('comment:reactions-updated')]
3435
public function reloadComments(): void
3536
{
3637
unset($this->comments);

0 commit comments

Comments
 (0)