Distinguish between subscriptions returning nil and not run

This commit is contained in:
Daniel Compton 2018-01-30 10:49:26 +13:00
parent 339d7c9147
commit beca2881df
3 changed files with 26 additions and 20 deletions

View File

@ -25,6 +25,7 @@ This version requires re-frame 0.10.4 to make use of the newly added Event panel
* All app-db and subscription path expansions are now independent of each other [#134](https://github.com/Day8/re-frame-trace/issues/134).
* Layer 2/3 calculations are more accurate now. We now use the last seen layer level when a subscription runs, to inform it's layer level if it was created or destroyed.
* View namespaces that are ignored are no longer shown when showing traces for all epochs.
* Distinguish between subscriptions that return `nil` values and those that haven't run yet.

View File

@ -391,22 +391,25 @@
:<- [:app-db/reagent-id]
:<- [:subs/subscription-info]
(fn [[traces app-db-id sub-info]]
(let [raw (map (fn [trace] (let [pod-type (sub-op-type->type trace)
path-data (get-in trace [:tags :query-v])
;; TODO: detect layer 2/3 for sub/create and sub/destroy
;; This information needs to be accumulated.
layer (if (some #(= app-db-id %) (get-in trace [:tags :input-signals]))
2
3)]
{:id (str pod-type (get-in trace [:tags :reaction]))
:type pod-type
:layer (get-in sub-info [(:operation trace) :layer])
:path-data path-data
:path (pr-str path-data)
:value (get-in trace [:tags :value])
;; TODO: Get not run subscriptions
}))
(let [raw (map (fn [trace]
(let [pod-type (sub-op-type->type trace)
path-data (get-in trace [:tags :query-v])
;; TODO: detect layer 2/3 for sub/create and sub/destroy
;; This information needs to be accumulated.
layer (if (some #(= app-db-id %) (get-in trace [:tags :input-signals]))
2
3)
sub
(-> {:id (str pod-type (get-in trace [:tags :reaction]))
:type pod-type
:layer (get-in sub-info [(:operation trace) :layer])
:path-data path-data
:path (pr-str path-data)
;; TODO: Get not run subscriptions
})]
(if (contains? (:tags trace) :value)
(assoc sub :value (get-in trace [:tags :value]))
sub)))
traces)
re-run (->> raw
(filter #(= :re-run (:type %)))

View File

@ -169,10 +169,12 @@
:style {:margin (css-join pod-padding pod-padding "0px" pod-padding)
:overflow-x "auto"
:overflow-y "hidden"}
:children [[components/simple-render
(:value pod-info)
["sub-path" path]
]]])]
:children [(if (contains? pod-info :value)
[components/simple-render
(:value pod-info)
["sub-path" path]]
[rc/label :style {:font-style "italic"} :label "Subscription not run, so no value produced."]
)]])]
[animated/component
(animated/v-box-options {:enter-animation "accordionVertical"
:leave-animation "accordionVertical"