From 87cd7a4c0f210fc3b655f067bf47947d57980e03 Mon Sep 17 00:00:00 2001 From: Stuart Mitchell Date: Thu, 26 Feb 2015 17:04:40 +1300 Subject: [PATCH] use lets in subscriptions in the todomvc example --- examples/todomvc/src/todomvc/core.cljs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/todomvc/src/todomvc/core.cljs b/examples/todomvc/src/todomvc/core.cljs index 90c76b8..3bfb197 100644 --- a/examples/todomvc/src/todomvc/core.cljs +++ b/examples/todomvc/src/todomvc/core.cljs @@ -93,16 +93,18 @@ :done (fn [db _] - (reaction (->> @(subscribe [:items]) - (filter :done) - count)))) + (let [items (subscribe [:items])] + (reaction (->> @items + (filter :done) + count))))) (register-sub :active (fn [db _] - (reaction (- (count @(subscribe [:items])) - @(subscribe [:done]))))) + (let [items (subscribe [:items]) + done (subscribe [:done])] + (reaction (- (count @items) @done)))))