use lets in subscriptions in the todomvc example

This commit is contained in:
Stuart Mitchell 2015-02-26 17:04:40 +13:00
parent 5f4f902a39
commit 87cd7a4c0f
1 changed files with 7 additions and 5 deletions

View File

@ -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)))))