Use the bundled reagent instead of the standard one
This commit is contained in:
parent
9cfe463d02
commit
0a7de66e4d
|
@ -12,7 +12,7 @@
|
||||||
[cljs.pprint :as pprint]
|
[cljs.pprint :as pprint]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
[reagent.core :as r]
|
[reagent.core :as real-reagent]
|
||||||
[reagent.interop :refer-macros [$ $!]]
|
[reagent.interop :refer-macros [$ $!]]
|
||||||
[reagent.impl.util :as util]
|
[reagent.impl.util :as util]
|
||||||
[reagent.impl.component :as component]
|
[reagent.impl.component :as component]
|
||||||
|
@ -21,7 +21,8 @@
|
||||||
[goog.object :as gob]
|
[goog.object :as gob]
|
||||||
[re-frame.interop :as interop]
|
[re-frame.interop :as interop]
|
||||||
[devtools.formatters.core :as devtools]
|
[devtools.formatters.core :as devtools]
|
||||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]))
|
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||||
|
[mranderson047.reagent.v0v6v0.reagent.core :as r]))
|
||||||
|
|
||||||
|
|
||||||
;; from https://github.com/reagent-project/reagent/blob/3fd0f1b1d8f43dbf169d136f0f905030d7e093bd/src/reagent/impl/component.cljs#L274
|
;; from https://github.com/reagent-project/reagent/blob/3fd0f1b1d8f43dbf169d136f0f905030d7e093bd/src/reagent/impl/component.cljs#L274
|
||||||
|
@ -73,11 +74,14 @@
|
||||||
res)))))})
|
res)))))})
|
||||||
|
|
||||||
|
|
||||||
|
(defonce real-custom-wrapper reagent.impl.component/custom-wrapper)
|
||||||
|
(defonce real-next-tick reagent.impl.batching/next-tick)
|
||||||
|
(defonce real-schedule reagent.impl.batching/schedule)
|
||||||
|
(defonce schedule-fn-scheduled? (atom false))
|
||||||
|
|
||||||
(defn monkey-patch-reagent []
|
(defn monkey-patch-reagent []
|
||||||
(let [#_#_real-renderer reagent.impl.component/do-render
|
(let [#_#_real-renderer reagent.impl.component/do-render
|
||||||
real-custom-wrapper reagent.impl.component/custom-wrapper
|
]
|
||||||
real-next-tick reagent.impl.batching/next-tick
|
|
||||||
real-schedule reagent.impl.batching/schedule]
|
|
||||||
|
|
||||||
|
|
||||||
#_(set! reagent.impl.component/do-render
|
#_(set! reagent.impl.component/do-render
|
||||||
|
@ -106,15 +110,20 @@
|
||||||
|
|
||||||
(real-custom-wrapper key f))))
|
(real-custom-wrapper key f))))
|
||||||
|
|
||||||
;; When this is enabled, the rendering of the trace panel causes an infinite loop.
|
(set! reagent.impl.batching/next-tick
|
||||||
#_(set! reagent.impl.batching/next-tick (fn [f]
|
(fn [f]
|
||||||
(real-next-tick (fn []
|
(real-next-tick (fn []
|
||||||
(trace/with-trace {:op-type :raf}
|
(trace/with-trace {:op-type :raf}
|
||||||
(f))))))
|
(f)
|
||||||
|
(trace/with-trace {:op-type :raf-end}))))))
|
||||||
|
|
||||||
#_(set! reagent.impl.batching/schedule schedule
|
#_(set! reagent.impl.batching/schedule
|
||||||
#_(fn []
|
(fn []
|
||||||
(reagent.impl.batching/do-after-render (fn [] (trace/with-trace {:op-type :raf-end})))
|
(reagent.impl.batching/do-after-render
|
||||||
|
(fn []
|
||||||
|
(when @schedule-fn-scheduled?
|
||||||
|
(trace/with-trace {:op-type :do-after-render})
|
||||||
|
(reset! schedule-fn-scheduled? false))))
|
||||||
(real-schedule)))))
|
(real-schedule)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
(ns day8.re-frame.trace.events
|
(ns day8.re-frame.trace.events
|
||||||
(:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
(:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||||
|
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||||
[day8.re-frame.trace.utils.utils :as utils]
|
[day8.re-frame.trace.utils.utils :as utils]
|
||||||
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[reagent.core :as r]
|
|
||||||
[goog.object]
|
[goog.object]
|
||||||
[re-frame.db]
|
[re-frame.db]
|
||||||
[day8.re-frame.trace.view.container :as container]
|
[day8.re-frame.trace.view.container :as container]
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
;; Use this namespace with the :preloads compiler option to perform the necessary setup for enabling tracing:
|
;; Use this namespace with the :preloads compiler option to perform the necessary setup for enabling tracing:
|
||||||
;; {:compiler {:preloads [day8.re-frame.trace.preload] ...}}
|
;; {:compiler {:preloads [day8.re-frame.trace.preload] ...}}
|
||||||
(trace/init-db!)
|
(trace/init-db!)
|
||||||
(trace/init-tracing!)
|
(defonce _ (trace/init-tracing!))
|
||||||
(trace/inject-devtools!)
|
(trace/inject-devtools!)
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
[(s/& ".trace--sub-run")
|
[(s/& ".trace--sub-run")
|
||||||
[".trace--op" {:color dark-purple}]]
|
[".trace--op" {:color dark-purple}]]
|
||||||
[(s/& ".trace--event")
|
[(s/& ".trace--event")
|
||||||
{:border-top [["1px" light-gray "solid"]]}
|
{:border-top [["2px" common/border-line-color "solid"]]}
|
||||||
[".trace--op" {:color common/event-color}]]
|
[".trace--op" {:color common/event-color}]]
|
||||||
[(s/& ".trace--render")
|
[(s/& ".trace--render")
|
||||||
[".trace--op" {:color dark-skyblue}]]
|
[".trace--op" {:color dark-skyblue}]]
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
(ns day8.re-frame.trace.view.app-db
|
(ns day8.re-frame.trace.view.app-db
|
||||||
(:require [reagent.core :as r]
|
(:require [clojure.string :as str]
|
||||||
[clojure.string :as str]
|
|
||||||
[devtools.prefs]
|
[devtools.prefs]
|
||||||
[devtools.formatters.core]
|
[devtools.formatters.core]
|
||||||
[day8.re-frame.trace.view.components :as components]
|
[day8.re-frame.trace.view.components :as components]
|
||||||
[day8.re-frame.trace.utils.re-com :as re-com]
|
[day8.re-frame.trace.utils.re-com :as re-com]
|
||||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
[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])
|
[day8.re-frame.trace.utils.re-com :as rc])
|
||||||
(:require-macros [day8.re-frame.trace.utils.macros :as macros]))
|
(:require-macros [day8.re-frame.trace.utils.macros :as macros]))
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
(ns day8.re-frame.trace.view.components
|
(ns day8.re-frame.trace.view.components
|
||||||
(:require [reagent.core :as r]
|
(:require [clojure.string :as str]
|
||||||
[clojure.string :as str]
|
|
||||||
[goog.fx.dom :as fx]
|
[goog.fx.dom :as fx]
|
||||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||||
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[day8.re-frame.trace.utils.re-com :as rc])
|
[day8.re-frame.trace.utils.re-com :as rc]
|
||||||
|
[mranderson047.reagent.v0v6v0.reagent.core :as r])
|
||||||
(:require-macros [day8.re-frame.trace.utils.macros :refer [with-cljs-devtools-prefs]]))
|
(:require-macros [day8.re-frame.trace.utils.macros :refer [with-cljs-devtools-prefs]]))
|
||||||
|
|
||||||
(defn search-input [{:keys [title placeholder on-save on-change on-stop]}]
|
(defn search-input [{:keys [title placeholder on-save on-change on-stop]}]
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
[garden.core :refer [css style]]
|
[garden.core :refer [css style]]
|
||||||
[garden.units :refer [px]]
|
[garden.units :refer [px]]
|
||||||
[re-frame.trace]
|
[re-frame.trace]
|
||||||
[reagent.core :as r]
|
|
||||||
[day8.re-frame.trace.utils.re-com :as rc]
|
[day8.re-frame.trace.utils.re-com :as rc]
|
||||||
[day8.re-frame.trace.common-styles :as common]))
|
[day8.re-frame.trace.common-styles :as common]))
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
[day8.re-frame.trace.utils.pretty-print-condensed :as pp]
|
[day8.re-frame.trace.utils.pretty-print-condensed :as pp]
|
||||||
[re-frame.trace :as trace]
|
[re-frame.trace :as trace]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[reagent.core :as r]
|
|
||||||
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
||||||
[cljs.pprint :as pprint]
|
[cljs.pprint :as pprint]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
|
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]))
|
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]))
|
||||||
|
|
||||||
(defn query->fn [query]
|
(defn query->fn [query]
|
||||||
|
@ -95,7 +95,8 @@
|
||||||
true (remove (fn [trace] (and (= :sub/create (:op-type trace))
|
true (remove (fn [trace] (and (= :sub/create (:op-type trace))
|
||||||
(get-in trace [:tags :cached?]))))
|
(get-in trace [:tags :cached?]))))
|
||||||
(seq @categories) (filter (fn [trace] (when (contains? @categories (:op-type trace)) trace)))
|
(seq @categories) (filter (fn [trace] (when (contains? @categories (:op-type trace)) trace)))
|
||||||
(seq @filter-items) (filter (apply every-pred (map query->fn @filter-items))))
|
(seq @filter-items) (filter (apply every-pred (map query->fn @filter-items)))
|
||||||
|
true (sort-by :id))
|
||||||
save-query (fn [_]
|
save-query (fn [_]
|
||||||
(if (and (= @filter-type :slower-than)
|
(if (and (= @filter-type :slower-than)
|
||||||
(js/isNaN (js/parseFloat @filter-input)))
|
(js/isNaN (js/parseFloat @filter-input)))
|
||||||
|
@ -103,6 +104,7 @@
|
||||||
(do
|
(do
|
||||||
(reset! input-error false)
|
(reset! input-error false)
|
||||||
(add-filter filter-items @filter-input @filter-type))))]
|
(add-filter filter-items @filter-input @filter-type))))]
|
||||||
|
|
||||||
[:div.tab-contents
|
[:div.tab-contents
|
||||||
[:div.filter
|
[:div.filter
|
||||||
[:div.filter-control
|
[:div.filter-control
|
||||||
|
|
Loading…
Reference in New Issue