bigskysoftware / htmx-extensions

164 stars 50 forks source link

[BUG] api.swap is not a function #67

Closed CRSylar closed 3 months ago

CRSylar commented 3 months ago

Hi !

i'm having problems using the extension.

i've got this error

TypeError: api.swap is not a function
    at swap (sse.js:283:9)
    at EventSource.listener (sse.js:122:11)

seems like the swap method in the call for api.swap do not exists.. i'm using the unpkg link, so i believe is the latest release

note. i've got this error regardless of using named events o the "message" one

Telroshan commented 3 months ago

Hey, seems you got it figured out as you closed the issue, but feel free to share what was the cause/solution so that if others stumble on the same problem, they might fix it thanks to your experience!

Looking at the error above, the only thing that comes to my mind is if you were using htmx 1 with the extensions of this repo, that use the htmx2-introduced swap method (so if you're still using htmx 1, indeed api.swap doesn't exist). Was that the cause, or was the problem somewhere else?