@thedavidmeister what tasks from hoplon are you running in the project?
@flyboarder ^^
yeah I saw but in the other project
yeah
weird, what does the build.boot look like?
of my project?
yeah
@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