|
34 | 34 | :displayName name |
35 | 35 | :cljsLegacyRender legacy-render |
36 | 36 | :reagentRender render-fun |
| 37 | + :componentDidMount (fn componentDidMount [] |
| 38 | + (this-as c |
| 39 | + (trace/with-trace |
| 40 | + {:op-type :componentDidMount |
| 41 | + :operation (operation-name c) |
| 42 | + :tags {:order (gobj/get c "cljsMountOrder")}}) |
| 43 | + (when-let [f (:componentDidMount fmap)] |
| 44 | + (.call f c)))) |
| 45 | + :componentWillUnmount (fn componentWillUnmount [] |
| 46 | + (this-as c |
| 47 | + (trace/with-trace |
| 48 | + {:op-type :componentWillUnmount |
| 49 | + :operation (operation-name c)}) |
| 50 | + (when-let [f (:componentWillUnmount fmap)] |
| 51 | + (.call f c)))) |
| 52 | + ;:shouldComponentUpdate |
| 53 | + #_(fn shouldComponentUpdate [nextprops nextstate] |
| 54 | + (this-as c |
| 55 | + (trace/with-trace |
| 56 | + {:op-type :should-upd |
| 57 | + :operation (operation-name c)} |
| 58 | + (when-let [f (:shouldComponentUpdate fmap)] |
| 59 | + (.call f c nextprops nextstate))))) |
37 | 60 | :render (fn render [] |
38 | 61 | (this-as c |
39 | 62 | (trace/with-trace |
40 | 63 | {:op-type :render |
41 | 64 | :tags (if-let [component-name (component/component-name c)] |
42 | 65 | {:component-name component-name} |
43 | 66 | {}) |
44 | | - :operation (operation-name c)}) |
45 | | - (if util/*non-reactive* |
46 | | - (component/do-render c compiler) |
47 | | - (let [^clj rat (gobj/get c "cljsRatom") |
48 | | - _ (batch/mark-rendered c) |
49 | | - res (if (nil? rat) |
50 | | - (ratom/run-in-reaction #(component/do-render c compiler) c "cljsRatom" |
51 | | - batch/queue-render component/rat-opts) |
52 | | - (._run rat false)) |
53 | | - cljs-ratom (gobj/get c "cljsRatom")] |
54 | | - (trace/merge-trace! |
55 | | - {:tags {:reaction (interop/reagent-id cljs-ratom) |
56 | | - :input-signals (when cljs-ratom |
57 | | - (map interop/reagent-id (gobj/get cljs-ratom "watching" :none)))}}) |
58 | | - res))))))) |
| 67 | + :operation (operation-name c)} |
| 68 | + (if util/*non-reactive* |
| 69 | + (component/do-render c compiler) |
| 70 | + (let [^clj rat (gobj/get c "cljsRatom") |
| 71 | + _ (batch/mark-rendered c) |
| 72 | + res (if (nil? rat) |
| 73 | + (ratom/run-in-reaction #(component/do-render c compiler) c "cljsRatom" |
| 74 | + batch/queue-render component/rat-opts) |
| 75 | + (._run rat false)) |
| 76 | + cljs-ratom (gobj/get c "cljsRatom")] |
| 77 | + (trace/merge-trace! |
| 78 | + {:tags {:reaction (interop/reagent-id cljs-ratom) |
| 79 | + :input-signals (when cljs-ratom |
| 80 | + (map interop/reagent-id (gobj/get cljs-ratom "watching" :none)))}}) |
| 81 | + res)))))))) |
59 | 82 |
|
60 | 83 | (defn patch-wrap-funs |
61 | 84 | [] |
62 | 85 | (set! reagent.impl.component/wrap-funs wrap-funs)) |
63 | 86 |
|
64 | | -(defonce original-custom-wrapper reagent.impl.component/custom-wrapper) |
| 87 | +;(defonce original-create-class reagent.impl.component/create-class) |
65 | 88 |
|
66 | | -(defn custom-wrapper |
67 | | - [key f] |
68 | | - (case key |
69 | | - :componentWillUnmount |
70 | | - (fn componentWillUnmount [] |
71 | | - (this-as c |
72 | | - (trace/with-trace |
73 | | - {:op-type key |
74 | | - :operation (last (string/split (component/component-name c) #" > ")) |
75 | | - :tags {:component-name (component/component-name c) |
76 | | - :reaction (interop/reagent-id (gobj/get c "cljsRatom"))}}) |
77 | | - (.call (original-custom-wrapper key f) c c))) |
78 | | - (original-custom-wrapper key f))) |
79 | | - |
80 | | -(defn patch-custom-wrapper |
81 | | - [] |
82 | | - (set! reagent.impl.component/custom-wrapper custom-wrapper)) |
| 89 | +#_(defn create-class |
| 90 | + [body compiler] |
| 91 | + (trace/with-trace |
| 92 | + {:op-type :create-class} |
| 93 | + (let [cmp (original-create-class body compiler)] |
| 94 | + (trace/merge-trace! |
| 95 | + {:operation (.-displayName cmp)}) |
| 96 | + cmp))) |
0 commit comments