ornament icon indicating copy to clipboard operation
ornament copied to clipboard

Defstyled component is not properly handling children when some of them are fragments with `unsafe-html`

Open chromalchemy opened this issue 4 months ago • 2 comments

Reverted to 661281f5aa7682cc4cb34a836e783ccb4841cda8 and it works as expected.

In my case i was rendering handlebars html.

Test case is something like:

(o/defstyled myelem :div)

 [:<>
   [:div.before-custom-elem]
   [myelem
    [:div.before-unsafe]
    [:<>
     [::hiccup/unsafe-html "{{open handlebars tag}}"]
     [:div.inside-unsafe]
     [::hiccup/unsafe-html "{{close handlebars tag}}"]]
    [:div.after-unsafe]]
   [:div.after-custom-elem]]

[:div.after-unsafe] was disappearing when rendering html.

Rendered to html with latest lambdaisland.hiccup Wanted to get this out there asap because this can silently break rendered html.

chromalchemy avatar Nov 02 '25 21:11 chromalchemy

Hi @chromalchemy

I first tried to reproduce the problem (using the latest version of ornament && hiccup), but I could not.

[:div.after-unsafe] is still showing.

Image

Could you provide more information? Or there is something I misunderstood?

humorless avatar Nov 04 '25 15:11 humorless

@chromalchemy which Hiccup implementation are you using (weavejester's original hiccup, lambdaisland.hiccup, reagent, ...?) Any chance you could put together a repo that reproduces the issue?

I had a look at the diff between the version you mention and the latest version and don't really see what's in there that could be causing this behaviour.

plexus avatar Nov 06 '25 10:11 plexus