This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-29
Channels
- # announcements (7)
- # babashka (36)
- # beginners (67)
- # braveandtrue (11)
- # cider (8)
- # clojure (52)
- # clojure-conj (4)
- # clojure-poland (1)
- # clojure-spec (9)
- # clojure-uk (8)
- # clojurescript (42)
- # core-typed (11)
- # cursive (4)
- # emacs (1)
- # fulcro (1)
- # graalvm (24)
- # hoplon (10)
- # hyperfiddle (1)
- # off-topic (30)
- # re-frame (7)
- # reitit (1)
- # sql (1)
hi everyone. something very strange is going on here:
(defn gallery-page []
(let [{:keys [name projects]} @(subscribe [:active-gallery])
page-ready? @(subscribe [:gallery-page-ready?])]
[:<>
[loader/view
{:ready? page-ready?}
[:section.hero.is-black
[:div.hero-body
[section-heading name]
(if-let [projects (seq projects)]
[:div.container
[grid/view projects
{:onLayoutComplete #(do
(js/console.log "hello")
(dispatch [:done-loading :active-gallery-layout]))}]]
[:div.content.has-text-centered.is-small.has-text-light
[:h5.subtitle "This gallery is empty"]])]]]]))
basically I’m using masonry-layout
and that console.log should only be called after the layout formation is complete. but for some reason it is being called straight away herethis library https://masonry.desandro.com/
The documentation talks about using node.on(eventName, handler)
, but you're doing something akin to node.onEventName = handler
. Maybe that's what the library doesn't like?
@p-himik actually the point here is
(if-let [projects (seq projects)]
[:div.container
[grid/view projects
{:onLayoutComplete #(do
(js/console.log "hello")
(dispatch [:done-loading :active-gallery-layout]))}]]
[:div.content.has-text-centered.is-small.has-text-light
[:h5.subtitle "This gallery is empty"]])
versus
(defn- projects-view [projects]
[:div.container
[grid/view projects
{:onLayoutComplete #(do
(js/console.log "hello")
(dispatch [:done-loading :active-gallery-layout]))}]])
.....
(if-let [projects (seq projects)]
[projects-view projects]
[:div.content.has-text-centered.is-small.has-text-light
[:h5.subtitle "This gallery is empty"]])