From 06f23cf6c805c89b88ae5eb2da00e70115f4f997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Sun, 26 Oct 2025 20:06:49 +0100 Subject: [PATCH] Refactor comments, yet again --- assets/controllers/comments_mercure_controller.js | 2 +- src/Twig/Components/Organisms/Comments.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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);