diff --git a/assets/controllers/comments_mercure_controller.js b/assets/controllers/comments_mercure_controller.js index 3e019ba..9be4631 100644 --- a/assets/controllers/comments_mercure_controller.js +++ b/assets/controllers/comments_mercure_controller.js @@ -23,7 +23,7 @@ export default class extends Controller { this.es = new EventSource(url.toString()); this.es.onmessage = async (msg) => { this.component.set('payloadJson', msg.data); - this.component.action('loadComments', { payload: msg.data }); + this.component.action('loadComments', { 'payload': msg.data }); await this.component.render(); }; } diff --git a/src/Twig/Components/Organisms/Comments.php b/src/Twig/Components/Organisms/Comments.php index 43f2498..e0182c2 100644 --- a/src/Twig/Components/Organisms/Comments.php +++ b/src/Twig/Components/Organisms/Comments.php @@ -9,6 +9,7 @@ use Symfony\Component\Messenger\Exception\ExceptionInterface; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\UX\LiveComponent\Attribute\AsLiveComponent; use Symfony\UX\LiveComponent\Attribute\LiveAction; +use Symfony\UX\LiveComponent\Attribute\LiveArg; use Symfony\UX\LiveComponent\Attribute\LiveProp; use Symfony\UX\LiveComponent\DefaultActionTrait; @@ -57,7 +58,7 @@ final class Comments } #[LiveAction] - public function loadComments($payload): array + public function loadComments(#[LiveArg] string $payload): array { $data = json_decode($payload);