This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-29
Channels
- # announcements (6)
- # babashka (7)
- # beginners (24)
- # calva (2)
- # cider (21)
- # clj-kondo (49)
- # cljdoc (29)
- # clojure (56)
- # clojure-dev (2)
- # clojure-europe (15)
- # clojure-nl (6)
- # clojure-norway (27)
- # clojure-uk (3)
- # clojuredesign-podcast (6)
- # clojurescript (1)
- # conjure (1)
- # core-async (8)
- # cryogen (2)
- # cursive (6)
- # data-science (1)
- # datomic (12)
- # events (1)
- # fulcro (16)
- # graalvm (28)
- # hyperfiddle (2)
- # lambdaisland (4)
- # leiningen (20)
- # observability (1)
- # off-topic (24)
- # pathom (5)
- # pedestal (10)
- # portal (7)
- # practicalli (1)
- # reitit (5)
- # rewrite-clj (20)
- # shadow-cljs (18)
- # vim (8)
- # xtdb (9)
I’m trying to render some Ornament hiccup in Portal . It has a notion of styled components that the default hiccuo viewer only seems to want to view as data (not rendering or displaying the html) Ornament works with lamdaisland hiccup. So I could pre-render the html. But i also cant figure out how to render any html string. The portal.viewer/html metadata doesnt seem to do it. (Can you even set metadata on a string?) https://github.com/lambdaisland/ornament
No, strings don't support metadata. However, you can use https://github.com/djblue/portal/blob/master/src/portal/viewer.cljc#L162-L164 which will wrap the string in something that does support metadata 👌
This is not working for me. Just show the regular inspector.
(->
"<div>hello world</div>"
(portal.viewer/html)
(with-meta
{:portal.viewer/default :portal.viewer/html})
(tap>))
Any hints?Ok that works! 🥳
But I had tried it before…?
I had to p/clear
before I could see the properly rendered output.
If I am testing different values in the tap>
pipeline, the portal view seems to remember earlier values and not update (or just keeps showing the old data), and it seems like things aren’t working.
If I explicity clear, then I get the fresh proper render.
Is this the case that explicit clearing is generally required?
What would you call this caching behavior so I can learn more about it?
(I probably need to learn more about tap>
Since metadata isn't part of equality, if the only thing changing is metadata, nothing will re-render.
Seems like sometimes I get a stale view that wont update until I clear. Even with same metadata. But will look to replicate. But it’s a minor issue. It’s great to be able to drive the view from code, so I can integrate the coding flow with Calva repl snippets!