From 8e6605f58dcec86db3166054b48f43d14612ba7f Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Fri, 9 Feb 2018 04:21:33 +1300 Subject: [PATCH] Provide a diff message when a sub wasn't run --- src/day8/re_frame/trace/view/subs.cljs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/day8/re_frame/trace/view/subs.cljs b/src/day8/re_frame/trace/view/subs.cljs index 756cd6a..65e55ed 100644 --- a/src/day8/re_frame/trace/view/subs.cljs +++ b/src/day8/re_frame/trace/view/subs.cljs @@ -152,7 +152,8 @@ (def no-prev-value-msg [:p {:style {:font-style "italic"}} "No previous value exists to diff"]) (def unchanged-value-msg [:p {:style {:font-style "italic"}} "Subscription value is unchanged"]) -(def not-run-msg [rc/label :style {:font-style "italic"} :label "Subscription not run, so no value produced."]) +(def sub-not-run-msg [:p {:style {:font-style "italic"}} "Subscription not run, so no diff is available"]) +(def not-run-yet-msg [rc/label :style {:font-style "italic"} :label "Subscription not run yet, so no value is available"]) (defn pod [{:keys [id layer path open? diff?] :as pod-info}] (let [render-diff? (and open? diff?) @@ -182,7 +183,7 @@ [components/simple-render main-value ["sub-path" path]] - not-run-msg + not-run-yet-msg )]]))] [animated/component (animated/v-box-options {:enter-animation "accordionVertical" @@ -190,6 +191,7 @@ :duration animation-duration}) (when render-diff? (let [diffable? (and value? previous-value?) + not-run? (= (:order pod-info) [:sub/not-run]) previous-value (:previous-value pod-info) value (:value pod-info) unchanged-value? (get-in pod-info [:sub/traits :unchanged?] false) @@ -210,6 +212,7 @@ :style {:overflow-x "auto" :overflow-y "hidden"} :children [(cond + not-run? sub-not-run-msg unchanged-value? unchanged-value-msg diffable? [components/simple-render diff-before @@ -230,6 +233,7 @@ :style {:overflow-x "auto" :overflow-y "hidden"} :children [(cond + not-run? sub-not-run-msg unchanged-value? unchanged-value-msg diffable? [components/simple-render diff-after