From 42f14305f4e5286af849395151df3a20ef182b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Sun, 26 Oct 2025 17:21:25 +0100 Subject: [PATCH] Refactor comments --- assets/controllers/comments_mercure_controller.js | 6 ++++-- templates/components/Organisms/Comments.html.twig | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/controllers/comments_mercure_controller.js b/assets/controllers/comments_mercure_controller.js index e5d5fa9..c61d946 100644 --- a/assets/controllers/comments_mercure_controller.js +++ b/assets/controllers/comments_mercure_controller.js @@ -14,12 +14,13 @@ import { Controller } from "@hotwired/stimulus"; */ export default class extends Controller { static values = { - coordinate: String, // e.g. "nevent1..." or your coordinate id + coordinate: String, }; static targets = ["list", "loading"]; connect() { + console.log("[comments-mercure] Connecting to Mercure for comments at", this.coordinateValue); this._debounceId = null; this._opened = false; @@ -54,7 +55,8 @@ export default class extends Controller { // Keep the UI usable even if Mercure hiccups this._hideLoading(); }; - this.eventSource.onmessage = () => { + this.eventSource.onmessage = (e) => { + console.log('Mercure MSG', e.data); // We ignore the payload; Mercure is just a signal to re-render the live component this._debouncedRefresh(); }; diff --git a/templates/components/Organisms/Comments.html.twig b/templates/components/Organisms/Comments.html.twig index e54a064..12497fe 100644 --- a/templates/components/Organisms/Comments.html.twig +++ b/templates/components/Organisms/Comments.html.twig @@ -1,7 +1,7 @@