hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
flyboarder 2018-01-18T00:40:40.000370Z

@thedavidmeister what tasks from hoplon are you running in the project?

2018-01-18T01:13:44.000149Z

@flyboarder ^^

flyboarder 2018-01-18T01:14:03.000271Z

yeah I saw but in the other project

2018-01-18T01:27:50.000308Z

yeah

flyboarder 2018-01-18T02:53:25.000068Z

weird, what does the build.boot look like?

2018-01-18T03:14:08.000032Z

of my project?

flyboarder 2018-01-18T03:20:35.000096Z

yeah

2018-01-18T04:05:16.000185Z

@flyboarder it's like 500 LOC

2018-01-18T04:05:24.000001Z

is there a particular part you're interested in?

flyboarder 2018-01-18T04:37:20.000022Z

just the calls to hoplon tasks

flyboarder 2018-01-18T04:37:37.000156Z

and where you require hoplon

2018-01-18T04:43:37.000180Z

kk, just deep in something atm, will post in a bit

2018-01-18T12:28:47.000057Z

hmmm i think i found a bug in merge-kids, or i'm trying to do something it wasn't designed to handle

2018-01-18T12:31:44.000075Z

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

2018-01-18T12:35:29.000051Z

this seems to work better

2018-01-18T12:35:33.000002Z

(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)))))

2018-01-18T12:36:02.000213Z

notably i'm doing a replaceChild instead of an insertBefore

2018-01-18T12:36:21.000177Z

i'm open to feedback on this one 🙂

flyboarder 2018-01-18T17:56:08.000217Z

@thedavidmeister i think that looks like a cleaner form of merge-kids