Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gnituy18 opened this issue Apr 19, 2024 · 0 comments
Open

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

gnituy18 opened this issue Apr 19, 2024 · 0 comments
Assignees

Comments

@gnituy18
Copy link

gnituy18 commented Apr 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants