Skip to content

Streaming html with hx-swap-oob #3149

Closed Answered by epragalakis
epragalakis asked this question in Q&A
Discussion options

You must be logged in to vote

nvm I got it working

It was just as simple as:

  • wrapping the server side html to a div with the swap-oob <div hx-swap-oob="beforeend:#CO2-graph-points"><circle cx="2025-01-18T15:00:32.000Z" cy="797" r="1" fill="red" /></div><div hx-swap-oob="beforeend:#Temperature-graph-points"><circle cx="2025-01-18T15:00:34.000Z" cy="19.662500000000023" r="1" fill="red" /></div>
  • and defining the html: <svg><g hx-swap-oob="true" id="CO2-graph-points"></g> </svg><svg><g hx-swap-oob="true" id="Temperature-graph-points"></g> </svg>

Still not sure why, but when I raised this issue the only thing I was doing differently was wrapping the response html in a template and an svg element as defined in the docs.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@epragalakis
Comment options

Answer selected by epragalakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant