Skip to content

feat: Allow forcing a refresh of the comments list - #124

Merged
luisdalmolin merged 1 commit into
mainfrom
feat/105-force-refresh-comments
Sep 22, 2026
Merged

luisdalmolin merged 1 commit into
mainfrom
feat/105-force-refresh-comments

Conversation

@luisdalmolin

Copy link
Copy Markdown
Member

Closes #105.

Problem

There was no way to reload <livewire:commentions.comments> immediately after saving the record. Custom getComments() items (e.g. activity-log status changes) only appeared after the next poll.

Fix

Listen for a public commentions:refresh Livewire event:

  • CommentList reloads its computed comments
  • Comments forwards the event as comment:saved so targeting the parent component still refreshes the nested list
protected function afterSave(): void
{
    $this->dispatch('commentions:refresh');
}

Tests

  • Comment list shows comments created after the initial render once commentions:refresh is dispatched
  • Comments component forwards commentions:refresh as comment:saved

Full suite: 182 passed. Pint clean. PHPStan unchanged — the 7 pre-existing errors in tests/Livewire/CommentReactionTest.php are also present on main.

Dispatch commentions:refresh to reload the list immediately, e.g. after
saving a record so custom getComments() items appear without polling.
@luisdalmolin
luisdalmolin merged commit 9772e52 into main Sep 22, 2026
20 checks passed
@luisdalmolin
luisdalmolin deleted the feat/105-force-refresh-comments branch September 22, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Force refresh of <livewire:commentions.comments> component

1 participant