Handle timing data not being available on initial load

This commit is contained in:
Daniel Compton 2018-01-16 14:26:18 +13:00
parent c243cfc0d5
commit 8b0056c2be
2 changed files with 21 additions and 11 deletions

View File

@ -251,3 +251,9 @@
(let [start-of-render (first (filter metam/request-animation-frame? traces))
end-of-epoch (utils/last-in-vec traces)]
(metam/elapsed-time start-of-render end-of-epoch))))
(rf/reg-sub
:timing/data-available?
:<- [:traces/current-event-traces]
(fn [traces]
(not (empty? traces))))

View File

@ -7,7 +7,8 @@
(:require-macros [day8.re-frame.trace.utils.macros :as macros]))
(defn render []
(let [timing-data-available? @(rf/subscribe [:timing/data-available?])]
(if timing-data-available?
[rc/v-box
:padding "12px 0px"
:children [[rc/label :label "Total Epoch Time"]
@ -17,4 +18,7 @@
[rc/label :label "Event time"]
[rc/label :label (str @(rf/subscribe [:timing/event-processing-time]) "ms")]
[rc/label :label "Render/Subscription time"]
[rc/label :label (str @(rf/subscribe [:timing/render-time]) "ms")]]])
[rc/label :label (str @(rf/subscribe [:timing/render-time]) "ms")]]]
[rc/v-box
:padding "12px 0px"
:children [[:h1 "No timing data available currently."]]])))