Skip to content

hx-trigger="sse:<eventName>" triggering twice in sse@2.1.0 #16

@gnituy18

Description

@gnituy18

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

I am currently using htmx@2.0.0-beta3 and sse@2.1.0

<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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions