This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-18
Channels
- # architecture (25)
- # beginners (57)
- # boot (3)
- # cider (38)
- # clara (6)
- # cljsrn (6)
- # clojure (54)
- # clojure-china (4)
- # clojure-greece (1)
- # clojure-italy (3)
- # clojure-romania (1)
- # clojure-russia (7)
- # clojure-spec (68)
- # clojure-uk (46)
- # clojurescript (73)
- # community-development (2)
- # core-async (7)
- # cursive (17)
- # datomic (143)
- # duct (2)
- # emacs (12)
- # events (5)
- # figwheel (3)
- # fulcro (15)
- # hoplon (19)
- # jobs (12)
- # jobs-discuss (85)
- # nginx (3)
- # off-topic (111)
- # onyx (7)
- # other-languages (1)
- # re-frame (30)
- # reagent (19)
- # remote-jobs (1)
- # ring (7)
- # rum (1)
- # shadow-cljs (18)
- # spacemacs (4)
- # specter (4)
- # sql (24)
- # test-check (1)
- # unrepl (10)
- # vim (6)
- # yada (1)
@thedavidmeister what tasks from hoplon are you running in the project?
yeah I saw but in the other project
weird, what does the build.boot look like?
of my project?
@flyboarder it's like 500 LOC
is there a particular part you're interested in?
just the calls to hoplon tasks
and where you require hoplon
kk, just deep in something atm, will post in a bit
hmmm i think i found a bug in merge-kids
, or i'm trying to do something it wasn't designed to handle
if you do like (div el-1 items el-2)
and then shuffle items (the actual els, not just the data in a for-tpl) then somehow el-2 ends up mixed in with the items
this seems to work better
(defn- merge-kids
[this _ new]
(let [new (->> (vflatten new) (reduce #(if (nil? %2) %1 (conj %1 %2)) []) (mapv ->node))
old (child-vec this)]
(loop [[o & os] old
[x & xs] new]
(when (or o x)
(cond
; do nothing if no changes
(= x o) nil
; if there is a new child swap out the old one
(and x o) (.replaceChild this x o)
; add new items
x (.appendChild this x)
; remove old items
o (.removeChild this o))
(recur
; ensure we don't re-process x as an o later or replaceChild will do bad
; things
(remove #{x} os)
xs)))))
notably i'm doing a replaceChild
instead of an insertBefore
i'm open to feedback on this one 🙂
@thedavidmeister i think that looks like a cleaner form of merge-kids