htmx-extensions icon indicating copy to clipboard operation
htmx-extensions copied to clipboard

`hx-trigger="sse:<eventName>"` triggering twice in [email protected]

Open gnituy18 opened this issue 1 year ago • 0 comments

The endpoint /component/weather-form/ is triggered twice when receiving the end event.

I am currently using [email protected] and [email protected]

<div hx-ext="sse" sse-close="end" sse-connect="/weather/">
  <div sse-swap="message"></div>
  <div hx-trigger="sse:end" hx-get="/component/weather-form/" hx-swap="afterbegin" hx-target="#form"></div>
</div>

After further investigation, I found that the onEvent function in the extension is triggered both by elements having sse-connect and hx-trigger="sse:*". Consequently, registerSSE is being triggered twice.

gnituy18 avatar Apr 19 '24 11:04 gnituy18