Fork me on GitHub
#portal
<
2022-12-12
>
genekim00:12:06

Lovely presentation by James Trunk on Portal — https://youtu.be/A-QvUw5LLVU

💯 7
🙏 2
portal 2
pez11:12:41

Hello! Is it possible to use the vscode extension with shadow-cljs?

djblue16:12:54

portal.api via node should work, however portal.web won't work. You will have to use the remote-api. https://cljdoc.org/d/djblue/portal/0.35.0/doc/guides/shadow-cljs for more info.

pez16:12:26

What can I expect when using the remote-api? My taps do not show up in the VS Code portal extension when I try.

pez16:12:30

I now notice I also get this in the browser console when I tap:

portal.client.web.js:3 Refused to connect to '' because it violates the document's Content Security Policy.

djblue16:12:02

Very odd, the main thing required for the web client to work is CORS. Is that being blocked here?

pez16:12:32

Probably. I'll figure out how to check.

🙏 1
pez17:12:42

I love you, @U1G869VNV!

❤️ 1
pez17:12:37

Answering my questions: • Yes, I can use the VS Code extensions with shadow-cljs (also for a browser target) if I use the remote-api (`portal.shadow.remote`) like described https://cljdoc.org/d/djblue/portal/0.35.0/doc/guides/shadow-cljs. • I can expect taps from the ClojureScript app to show in the same portal as taps from my Clojure backend app. 🎉

🎉 1
pez18:12:33

Now I need to figure out how to also hook my node session to portal. That's where the tests are auto-running.

djblue18:12:04

Did you want to pipe node taps to the jvm portal?

jason190323:12:30

Hi, is it possible to have tap>s appear in the Portal UI as trees by default? Every tap> I evaluate appears with :portal.viewer/inspector as the viewer. Placing https://github.com/djblue/portal/blob/master/src/examples/default_visualizer.clj on the data passed to a tap> works, but I was hoping for something I could, say, pass to p/open that would set the default viewer without having to attach metadata to every tap> call. I am using the IntelliJ plugin.

djblue23:12:48

I think the easiest way to do this is to pass a custom submit function to add-tap:

(defn can-meta? [value]
  (instance? clojure.lang.IObj value))

(defn submit [value]
  (p/submit
   (if-not (can-meta? value)
     value
     (with-meta value {:portal.viewer/default :portal.viewer/tree}))))

(add-tap submit)

jason190300:12:00

That worked. Thank you!

pez15:12:49

For shadow-cljs I did this:

(defn submit [value]
  (shadow/submit
    (if (implements? IWithMeta value)
      (with-meta value {:portal.viewer/default :portal.viewer/tree})
      value)))

(add-tap submit)

pez17:12:37

Answering my questions: • Yes, I can use the VS Code extensions with shadow-cljs (also for a browser target) if I use the remote-api (`portal.shadow.remote`) like described https://cljdoc.org/d/djblue/portal/0.35.0/doc/guides/shadow-cljs. • I can expect taps from the ClojureScript app to show in the same portal as taps from my Clojure backend app. 🎉

🎉 1