Add initial diffing to app-db panel
This commit is contained in:
parent
33f476da43
commit
0f6349682c
|
@ -131,8 +131,6 @@
|
|||
(trace/with-trace {:op-type :raf}
|
||||
(f)
|
||||
(trace/with-trace {:op-type :raf-end})
|
||||
(js/console.log "Do after render" reagent.impl.batching/render-queue)
|
||||
(js/console.log "Component queue" (.-componentQueue reagent.impl.batching/render-queue) "after render" (.-afterRender reagent.impl.batching/render-queue))
|
||||
(when (false? (.-scheduled? reagent.impl.batching/render-queue))
|
||||
(trace/with-trace {:op-type :reagent/quiescent}))
|
||||
|
||||
|
|
|
@ -199,7 +199,6 @@
|
|||
:partitions []}
|
||||
traces)
|
||||
matches (:partitions partitions)]
|
||||
#?(:cljs (js/console.log "Partitions:" partitions))
|
||||
{:matches matches}))
|
||||
|
||||
(defn matched-event [match]
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
{:white-space "nowrap"}]
|
||||
["tspan, textPath"
|
||||
{:white-space "inherit"}]
|
||||
;; No :focus
|
||||
;; No :focus rule
|
||||
["*"
|
||||
{:transform-origin "0px 0px 0px"}]
|
||||
["html|* > svg"
|
||||
|
|
|
@ -41,6 +41,18 @@
|
|||
(fn [db _]
|
||||
(get db :app-db)))
|
||||
|
||||
(rf/reg-sub
|
||||
:app-db/current-epoch-app-db-after
|
||||
:<- [:epochs/current-event-trace]
|
||||
(fn [trace _]
|
||||
(get-in trace [:tags :app-db-after])))
|
||||
|
||||
(rf/reg-sub
|
||||
:app-db/current-epoch-app-db-before
|
||||
:<- [:epochs/current-event-trace]
|
||||
(fn [trace _]
|
||||
(get-in trace [:tags :app-db-before])))
|
||||
|
||||
(rf/reg-sub
|
||||
:app-db/paths
|
||||
:<- [:app-db/root]
|
||||
|
@ -150,10 +162,16 @@
|
|||
match)))
|
||||
|
||||
(rf/reg-sub
|
||||
:epochs/current-event
|
||||
:epochs/current-event-trace
|
||||
:<- [:epochs/current-match]
|
||||
(fn [match _]
|
||||
(get-in (metam/matched-event match) [:tags :event])))
|
||||
(metam/matched-event match)))
|
||||
|
||||
(rf/reg-sub
|
||||
:epochs/current-event
|
||||
:<- [:epochs/current-event-trace]
|
||||
(fn [trace _]
|
||||
(get-in trace [:tags :event])))
|
||||
|
||||
(rf/reg-sub
|
||||
:epochs/number-of-matches
|
||||
|
@ -223,7 +241,6 @@
|
|||
(fn [traces]
|
||||
(let [start-of-epoch (nth traces 0)
|
||||
finish-run (first (filter metam/finish-run? traces))]
|
||||
(js/console.log "Start" start-of-epoch "fin" finish-run)
|
||||
(metam/elapsed-time start-of-epoch finish-run))))
|
||||
|
||||
(rf/reg-sub
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||
[day8.re-frame.trace.utils.re-com :as rc :refer [css-join]]
|
||||
[day8.re-frame.trace.common-styles :as common])
|
||||
[day8.re-frame.trace.common-styles :as common]
|
||||
[clojure.data])
|
||||
(:require-macros [day8.re-frame.trace.utils.macros :as macros]))
|
||||
|
||||
(def delete (macros/slurp-macro "day8/re_frame/trace/images/delete.svg"))
|
||||
|
@ -164,6 +165,11 @@
|
|||
[rc/gap-f :size common/gs-12s]]])
|
||||
|
||||
(defn pod [{:keys [id path open? diff?] :as pod-info}]
|
||||
(let [render-diff? (and open? diff?)
|
||||
app-db-after (rf/subscribe [:app-db/current-epoch-app-db-after])
|
||||
app-db-before (rf/subscribe [:app-db/current-epoch-app-db-before])
|
||||
[diff-before diff-after _] (when render-diff?
|
||||
(clojure.data/diff @app-db-before @app-db-after))]
|
||||
[rc/v-box
|
||||
:class "app-db-path"
|
||||
:style {:border-bottom-left-radius "3px"
|
||||
|
@ -176,8 +182,27 @@
|
|||
:style {:background-color cljs-dev-tools-background
|
||||
:padding common/gs-7s
|
||||
:margin (css-join pad-padding pad-padding "0px" pad-padding)}
|
||||
:children ["---main-section---"]])
|
||||
(when (and open? diff?)
|
||||
:children [
|
||||
|
||||
[components/simple-render
|
||||
@app-db-after
|
||||
|
||||
#_{:todos [1 2 3]}
|
||||
#_(get-in @app-db path)
|
||||
#_[rc/h-box
|
||||
:align :center
|
||||
:children [[:button.subtree-button
|
||||
[:span.subtree-button-string
|
||||
(str path)]]
|
||||
[:img
|
||||
{:src (str "data:image/svg+xml;utf8," delete)
|
||||
:style {:cursor "pointer"
|
||||
:height "10px"}
|
||||
:on-click #(rf/dispatch [:app-db/remove-path path])}]]]
|
||||
#_[path]]
|
||||
|
||||
#_"---main-section---"]])
|
||||
(when render-diff?
|
||||
[rc/v-box
|
||||
:height common/gs-19s
|
||||
:justify :end
|
||||
|
@ -186,15 +211,16 @@
|
|||
;:class "app-db-path--label"
|
||||
:label "ONLY BEFORE"
|
||||
:on-click #(println "Clicked [ONLY BEFORE]")]]])
|
||||
(when (and open? diff?)
|
||||
(when render-diff?
|
||||
[rc/v-box
|
||||
:height "60px"
|
||||
:min-width "100px"
|
||||
:style {:background-color cljs-dev-tools-background
|
||||
:padding common/gs-7s
|
||||
:margin (css-join "0px" pad-padding)}
|
||||
:children ["---before-diff---"]])
|
||||
(when (and open? diff?)
|
||||
:children [[components/simple-render
|
||||
diff-before]]])
|
||||
(when render-diff?
|
||||
[rc/v-box
|
||||
:height common/gs-19s
|
||||
:justify :end
|
||||
|
@ -203,16 +229,17 @@
|
|||
;:class "app-db-path--label"
|
||||
:label "ONLY AFTER"
|
||||
:on-click #(println "Clicked [ONLY AFTER]")]]])
|
||||
(when (and open? diff?)
|
||||
(when render-diff?
|
||||
[rc/v-box
|
||||
:height "60px"
|
||||
:min-width "100px"
|
||||
:style {:background-color cljs-dev-tools-background
|
||||
:padding common/gs-7s
|
||||
:margin (css-join "0px" pad-padding)}
|
||||
:children ["---after-diff---"]])
|
||||
:children [[components/simple-render
|
||||
diff-before]]])
|
||||
(when open?
|
||||
[rc/gap-f :size pad-padding])]])
|
||||
[rc/gap-f :size pad-padding])]]))
|
||||
|
||||
(defn no-pods []
|
||||
[rc/h-box
|
||||
|
|
Loading…
Reference in New Issue