Skip to content

Commit

Permalink
update delayed-class handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdzugan committed May 14, 2020
1 parent c5d13ce commit 6f75805
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject mayu "0.1.39"
(defproject mayu "0.1.40"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
Expand Down
13 changes: 6 additions & 7 deletions src/cljs/mayu/attach.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
curr-mutable (or (aget curr-data "mutable") #js {})
prev-mutable (or (aget prev-data "mutable") #js {})
path (aget curr-data "path")]
(when (and (.hasOwnProperty curr-data "delayed-class")
(not (.hasOwnProperty prev-data "delayed-class")))
(js/setTimeout #(->> (aget curr-data "delayed-class")
(aset elm "className"))
100))
(doseq [kw-key dom/mutable-keys]
(let [key (name kw-key)
val (aget curr-mutable key)]
Expand Down Expand Up @@ -168,14 +163,18 @@
(copy-to-thunk vnode thunk)))

(defn thunk-prepatch [prev curr]
(handle-delayed-class prev curr)
(let [prev-data (or (aget prev "data") #js {})
curr-data (or (aget curr "data") #js {})
prev-args (or (aget prev-data "args") [])
curr-args (or (aget curr-data "args") [])
[_ _ _ path] curr-args]
(swap! g-render-info #(assoc-in %1 [:els path] (aget prev "elm")))
(copy-to-thunk (if (= prev-args curr-args) prev (build-thunk curr)) curr)))
(copy-to-thunk (if (= prev-args curr-args)
prev
(do
(handle-delayed-class prev curr)
(build-thunk curr)))
curr)))

(defn thunk [path tag data children]
(let [jsdata #js {:hook #js {:init thunk-init
Expand Down

0 comments on commit 6f75805

Please sign in to comment.