This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-19
Channels
- # announcements (1)
- # babashka (40)
- # beginners (84)
- # biff (46)
- # calva (37)
- # cherry (2)
- # cider (18)
- # clj-otel (5)
- # clojure (53)
- # clojure-europe (39)
- # clojure-hungary (12)
- # clojure-norway (40)
- # clojure-sweden (2)
- # clojure-uk (2)
- # clojurescript (6)
- # community-development (21)
- # cursive (28)
- # data-science (12)
- # datomic (3)
- # figwheel-main (2)
- # fulcro (12)
- # graalvm (7)
- # gratitude (1)
- # hyperfiddle (23)
- # integrant (9)
- # jobs (2)
- # leiningen (4)
- # lsp (8)
- # malli (3)
- # missionary (1)
- # off-topic (39)
- # polylith (3)
- # portal (33)
- # practicalli (4)
- # re-frame (3)
- # releases (1)
- # sci (53)
- # solo-full-stack (8)
- # sql (5)
- # timbre (9)
Did pagination feature become part of Portal? No desperate need, mostly curious. I've used Cider Inspector to paginate through largish data science related data sets (e.g. covid19 statistics for the UK) and paging through 50 results at a time stopped Emacs grinding to a halt. I assume there is some limit to what portal can comfortably display without some performance issues with the browser its running in... maybe, or maybe not.. Thanks.
I think there are two distinct sub problems here, serialization and rendering. Serialization is done eagerly, so things like infinite seqs will break Portal, but it's generally fast enough that most values I work with don't cause issues. Rendering is done lazily and is realized as you scroll. Currently, there is no pagination support in Portal, but it would be relatively easy to add as part of rendering. Is there a particular issue / ux you were thinking of?
Ah, good to know. I dont have a current issue, however, I did find paginating through results very useful when building a Covid dashboard project. It was useful to check through at least some of the data set to ensure values were being propigated as I when through several data transformations. e.g. raw data > clojure data > visualisation data structure. I remember using inspect tools to help understand the large geojson format (which seems to be far too interesting to easily deal with without a good tool). Next time I do a project around this size data I'll feedback on what works and any challenges around using Portal for this type of thing. Thank you.
{:$schema "",
:data {:url ""},
:projection {:type "albersUsa"},
:mark "circle",
:encoding
{:longitude {:field "longitude", :type "quantitative"},
:latitude {:field "latitude", :type "quantitative"},
:size {:value 10}},
:config {:view {:stroke "transparent"}}}
The data looks like ☝️One of the biggest challenges I had with visualising the data accurately was geographical boundaries in geojson being different to political boundaries the raw data was organised in. So this type of Portal visualisation would be incredibly helpful, thanks for providing the examples.
maybe related to the standalone Portal q, is there an easy way to embed Portal in an existing cljs application?
What type of embedding are you thinking here? Like using the viewers in different contexts outside of the main portal app? Or having the app be available without the normal runtime connection?
I was thinking more of something that could go into an existing window, but this works 😄 thanks!
I think gettin the same version of the app opened in an iframe might be doable :thinking_face:
https://github.com/djblue/portal/blob/master/src/portal/runtime/web/launcher.cljs#L62-L66 is the current open code for portal.web
yeah, I think I saw some Clerk POC that did this? or maybe not, since that had a clj part
trying to put the blob url in an iframe gives me be8db697-dd3a-40a2-b8f6-148759936463:5050 WebSocket connection to '
. anyway, the separate window seems good enough for my purpose
Ohh, it's probably related to https://github.com/djblue/portal/blob/master/src/portal/ui/rpc.cljs#L118
hah!
(defn portal-iframe []
(swap! rt/sessions assoc-in [(:session-id @c/session) :options] {})
(swap! c/session rt/open-session)
(let [url (str->src (index/html {:code-url code-url :platform "web"})
"text/html")]
[:iframe {:src url
:width "100%"
:height 600
:ref (fn [x]
(when x
(-> x .-contentWindow .-window .-opener (set! js/window))
(reset! c/connection (-> x .-contentWindow)))
(c/make-atom (:session-id @c/session)))}]))
I assume it's because they share the same host :thinking_face: I'm down to add support to portal.web for :launcher :iframe
if you want.
this is what I've got so far. launcher iframe-url + setting the opener as a hack is probably not ideal, but not sure where to go from here https://github.com/djblue/portal/pull/195/files
Ohh, I think I was expecting Portal itself to own the iframe. Do you want to be able to place the iframe in a specific place in your app?
I mainly wouldn't want the downstream consumer to have to know about this type of stuff:
(-> x .-contentWindow .-window .-opener (set! js/window))
(reset! c/connection (-> x .-contentWindow))
I do like that you have an example though 👌Perhaps the consumer could pass in the element to inject the iframe into? :thinking_face:
(portal.web/open {:launcher :iframe :iframe-element el})
is kinda the api I had in mind
not beautiful, but almost there 😄 https://github.com/djblue/portal/pull/195/commits/c2668a54d459208b16fff9c6d6651b7891d7b6ff