Fork me on GitHub
#re-frame
<
2017-11-18
>
sandbags22:11:20

I'm a little puzzled. I have a key-value map in my db which I offer a subscription for. But the subscription (a very simple (reg-sub :foo (fn [db] (:foo db)))) is returning a sequence of the values, not the map. What am I missing?

mikethompson22:11:22

My guess is that :foo is not what you think it is :-)

mikethompson22:11:45

Because everything else about the subscription looks right

sandbags22:11:41

@mikethompson (type (:actors @re-frame.db/app-db)) => cljs.core/PersistentHashMap , (type @(re-frame.core/subscribe [:actors])) => cljs.core/ValSeq

sandbags22:11:09

@mikethompson (re-frame/reg-sub :actors (fn [db] (:actors db)))

sandbags22:11:53

where have i gone wrong in what I think :foo (masquerading as :actors) is?

mikethompson22:11:35

Sorry, can't see any obvious problem

sandbags22:11:22

the problem is that my dereferenced subscription is a sequence of the values of the map, not the map

danielneal22:11:35

You are sure you haven't over ridden the definition or are seeing old code

danielneal22:11:07

Sometimes when I get weird stuff like that I have to lein clean and start over

sandbags22:11:21

@danieleneal damnit, you are dead right thank you.

sandbags22:11:37

@mikethompson sorry, front-of-screen problem here

sandbags22:11:58

somehow i decided to also add a second subscription with the same name later that used (vals :actors)

sandbags22:11:31

i would never have thought to look for it without prompting because i would have assumed I wasn't that stupid!

danielneal22:11:49

We've all been there 😁

sandbags22:11:28

too many times! 🙂