Create separate subs that ignore view namespaces
These are only needed in the Trace panel, so we don't need to pay the cost elsewhere. This also fixes the bug where ignored view namespaces were shown when showing all traces in the Trace panel.
This commit is contained in:
parent
b62ed52847
commit
6465a09d08
|
@ -13,12 +13,14 @@ All notable changes to this project will be documented in this file. This change
|
|||
* The version of Garden that re-frame-trace uses is now bundled as a source dependency so you should no longer get conflicts if you use Garden 2.
|
||||
* Refactored re-frame-trace trace parsing internals to incrementally parse new traces.
|
||||
* Clicking on a trace's expanded information now prints the entire trace to the console instead of just the tags.
|
||||
* Improved efficency of rendering views that do not need to filter out view namespaces.
|
||||
|
||||
### Fixed
|
||||
|
||||
* External windows not loading
|
||||
* 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.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -514,13 +514,16 @@
|
|||
subscription-info (->> new-traces
|
||||
(filter metam/subscription-re-run?)
|
||||
(reduce (fn [state trace]
|
||||
;; TODO: can we take any shortcuts by assuming that a sub with
|
||||
;; Can we take any shortcuts by assuming that a sub with
|
||||
;; multiple input signals is a layer 3? I don't *think* so because
|
||||
;; one of those input signals could be a naughty subscription to app-db
|
||||
;; directly.
|
||||
;; If any of the input signals are app-db, it is a layer 2 sub, else 3
|
||||
;; If we knew when subscription handlers were loaded/reloaded then
|
||||
;; we could avoid doing most of this work, and only check the input
|
||||
;; signals if we hadn't seen it before, or it had been reloaded.
|
||||
(assoc-in state
|
||||
[(:operation trace) :layer]
|
||||
;; If any of the input signals are app-db, it is a layer 2 sub, else 3
|
||||
(if (some #(= app-db-id %) (get-in trace [:tags :input-signals]))
|
||||
2
|
||||
3)))
|
||||
|
|
|
@ -145,29 +145,37 @@
|
|||
(fn [traces _]
|
||||
(count traces)))
|
||||
|
||||
(rf/reg-sub
|
||||
:traces/all-visible-traces
|
||||
:<- [:traces/all-traces]
|
||||
:<- [:settings/filtered-view-trace]
|
||||
(fn [[all-traces filtered-views] _]
|
||||
(let [munged-ns (->> filtered-views
|
||||
(map (comp munge :ns-str))
|
||||
(set))]
|
||||
(into []
|
||||
;; Filter out view namespaces we don't care about.
|
||||
(remove
|
||||
(fn [trace] (and (metam/render? trace)
|
||||
(contains? munged-ns (subs (:operation trace) 0 (str/last-index-of (:operation trace) "."))))))
|
||||
all-traces))))
|
||||
|
||||
(rf/reg-sub
|
||||
:traces/current-event-traces
|
||||
:<- [:traces/all-visible-traces]
|
||||
:<- [:traces/all-traces]
|
||||
:<- [:epochs/beginning-trace-id]
|
||||
:<- [:epochs/ending-trace-id]
|
||||
(fn [[traces beginning ending] _]
|
||||
(into [] (filter #(<= beginning (:id %) ending)) traces)))
|
||||
|
||||
(defn filter-ignored-views [[traces filtered-views] _]
|
||||
(let [munged-ns (->> filtered-views
|
||||
(map (comp munge :ns-str))
|
||||
(set))]
|
||||
(into []
|
||||
;; Filter out view namespaces we don't care about.
|
||||
(remove
|
||||
(fn [trace] (and (metam/render? trace)
|
||||
(contains? munged-ns (subs (:operation trace) 0 (str/last-index-of (:operation trace) "."))))))
|
||||
traces)))
|
||||
|
||||
(rf/reg-sub
|
||||
:traces/current-event-visible-traces
|
||||
:<- [:traces/current-event-traces]
|
||||
:<- [:settings/filtered-view-trace]
|
||||
filter-ignored-views)
|
||||
|
||||
(rf/reg-sub
|
||||
:traces/all-visible-traces
|
||||
:<- [:traces/all-traces]
|
||||
:<- [:settings/filtered-view-trace]
|
||||
filter-ignored-views)
|
||||
|
||||
(rf/reg-sub
|
||||
:traces/show-epoch-traces?
|
||||
:<- [:traces/trace-root]
|
||||
|
|
|
@ -89,8 +89,8 @@
|
|||
trace-detail-expansions (rf/subscribe [:traces/expansions])
|
||||
beginning (rf/subscribe [:epochs/beginning-trace-id])
|
||||
end (rf/subscribe [:epochs/ending-trace-id])
|
||||
traces (rf/subscribe [:traces/all-traces])
|
||||
current-traces (rf/subscribe [:traces/current-event-traces])
|
||||
traces (rf/subscribe [:traces/all-visible-traces])
|
||||
current-traces (rf/subscribe [:traces/current-event-visible-traces])
|
||||
show-epoch-traces? (rf/subscribe [:traces/show-epoch-traces?])]
|
||||
(fn []
|
||||
(let [toggle-category-fn #(rf/dispatch [:traces/toggle-categories %])
|
||||
|
|
Loading…
Reference in New Issue