I believe that having a shouldSwap boolean field on the htmx:sseBeforeMessage event detail would make this event more useful. There are situations, I have personally come across them, where we don't want to swap in the SSE message and being able to opt out of that would be very useful.
I can make a PR for this. In my own project I have found that it can be achieved very easily.
// swap the response into the DOM and trigger a notification
event.shouldSwap = true
if (!api.triggerEvent(elt, 'htmx:sseBeforeMessage', event)) {
return
}
if (event.shouldSwap) {
swap(elt, event.data)
api.triggerEvent(elt, 'htmx:sseMessage', event)
}
I believe that having a
shouldSwap
boolean field on thehtmx:sseBeforeMessage
event detail would make this event more useful. There are situations, I have personally come across them, where we don't want to swap in the SSE message and being able to opt out of that would be very useful.I can make a PR for this. In my own project I have found that it can be achieved very easily.