portal

Henry 2025-07-09T17:18:25.212689Z

Hi! I got Portal to work in my dockerized Clojure instance today and so far I really like it. I am trying to get access to the values I navigate to in my REPL. According to https://cljdoc.org/d/djblue/portal/0.59.1/doc/ui-concepts/history, the values should be in the portal atom after navigation. However when I evaluate p (which i defined with (*def* p (p/open {:port 7123 :launcher :vs-code}))), this is the only value in there: {:session-id #uuid "2a331435-4c67-42e9-81bc-0fbe5a8b0b09"} . Am I misunderstanding how this should work?

djblue 2025-07-09T17:20:31.243829Z

@p will have the selected value, I think that's what you are looking for 👍

Henry 2025-07-09T17:24:45.907279Z

Oh wow, I just assumed it was a map based on the looks of it. Thanks anyway, works perfectly!

djblue 2025-07-09T17:28:09.064539Z

The value retuned from open is a record which implements the deref interface: https://github.com/djblue/portal/blob/master/src/portal/runtime/jvm/client.clj#L85-L86 so the confusion is totally understandable.

Henry 2025-07-09T17:50:38.422929Z

can I get all the values in the session as well (as opposed to first only)?

djblue 2025-07-09T17:51:15.957999Z

Like for multi-select?

Henry 2025-07-09T17:52:45.576539Z

Ah, I understand now. No I did not mean multi-select, I thought it would basically append all values that get selected over time to an ever growing list.

Henry 2025-07-09T18:18:05.431369Z

However, I am interested in how I can get the values from a multi-select

Henry 2025-07-09T18:22:23.426009Z

I understand I can copy them as edn, but sometimes I'd like the actual object (for instance when the value I am interested in is a Bytestream)

djblue 2025-07-09T18:23:24.776679Z

(portal.api/selected <portal-session-returned-by-open>) or (mapcat portal.api/selected (portal.api/sessions))

djblue 2025-07-09T18:23:31.730029Z

I think the above is what you would need

Henry 2025-07-09T19:24:38.281179Z

Great, thanks!