This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-04
Channels
- # adventofcode (129)
- # announcements (1)
- # babashka (7)
- # beginners (30)
- # calva (42)
- # cider (2)
- # clj-commons (2)
- # clj-on-windows (27)
- # clj-yaml (4)
- # clojure (69)
- # clojure-belgium (4)
- # clojure-europe (5)
- # clojure-norway (4)
- # clr (1)
- # css (3)
- # datomic (19)
- # dev-tooling (2)
- # events (1)
- # humbleui (1)
- # hyperfiddle (17)
- # introduce-yourself (4)
- # java (1)
- # joyride (3)
- # kaocha (1)
- # lsp (4)
- # malli (10)
- # mount (1)
- # nbb (34)
- # off-topic (37)
- # pathom (1)
- # ring (4)
- # tools-deps (12)
I’m trying to set the scrollOffset of dom node to its scroll height (aka scroll to bottom) but it looks like my code is running before children rendered
show me what you have please
(dom/div (println dom/node)) will run println immediately after mount
no not children
I need to scroll all the way down in a dom node. can’t do that until its children rendered
ah I think I got it. is this idiomatic?
(dom/div
{:style {:display :grid
:grid-template-columns "min-content auto"}
:class [:gap3 :h5 :overflow-y-auto]}
(p/for [{:keys [by msg]} transcript]
(dom/div
{:class [:b]
:style {:grid-column 1}}
(case by
:AI "Therapist:"
:user "You:"))
(dom/div
{:style {:grid-column 2}}
msg))
(new (m/observe
(fn [!]
(! nil)
(sdom/scroll-to-bottom dom/node)))))
the photon DAG will maximize concurrency- i.e. the m/observe here is racing the p/for
maybe have p/for return each of the dom/nodes, then call last to get the final child and then depend on it for the measurement
you don't even need that, you just need the measurement to depend on the result of the p/for, which is only available after the children have run
also the side effect doesn't need to be in m/observe, you can just run side effects like a println