Skip to content

Commit f2734aa

Browse files
committed
Fix tests
1 parent 5ab8788 commit f2734aa

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Livewire/Comment.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function handleReactionToggledEvent(string $reaction, int $commentId): vo
3939
#[Renderless]
4040
public function delete()
4141
{
42-
if (! auth()->user()?->can('delete', $this->comment)) {
42+
if (! Config::resolveAuthenticatedUser()?->can('delete', $this->comment)) {
4343
return;
4444
}
4545

@@ -55,6 +55,9 @@ public function delete()
5555

5656
public function render(): View
5757
{
58+
// Ensure a valid (empty) error bag exists to avoid null error bag issues during view rendering
59+
$this->resetValidation();
60+
5861
return view('commentions::comment');
5962
}
6063

src/Livewire/Comments.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public function save()
4545

4646
public function render()
4747
{
48+
// Ensure a valid (empty) error bag exists to avoid null error bag issues during view rendering
49+
$this->resetValidation();
50+
4851
return view('commentions::comments');
4952
}
5053

src/Livewire/Reactions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public function handleReactionToggle(string $reaction): void
2727

2828
public function render(): View
2929
{
30+
// Ensure a valid (empty) error bag exists to avoid null error bag issues during view rendering
31+
$this->resetValidation();
32+
3033
return view('commentions::reactions', [
3134
'allowedReactions' => Config::getAllowedReactions(),
3235
]);

0 commit comments

Comments
 (0)