Fork me on GitHub
#re-frame
<
2020-02-25
>
rschmukler01:02:22

Is there a way to inject the DB into a layer 3 subscription? Creating a :db subscription that ends up being identity feels weird. Alternatively should I just be using non-anonymous functions for the data that I want to inject via layer 3 and then just use layer 2? Any recommendations on how to best do it?

shaun-mahood01:02:49

Have you got an example of what you’re trying to do?

p-himik07:02:44

Check out reg-sub-raw as well. I usually end up using it in similar situations.

royalaid03:02:09

Hey guys, is there a better way to do

(some-> (rf/subscribe [:view.asset/active-asset])
        deref)
?

beders20:02:09

The deref should not stumble over nil. If there's no subscription though, than I would consider it a bug

royalaid03:02:20

because the value of the subscription can be null

royalaid03:02:29

but getting null and passing it to deref blows up

mikethompson03:02:53

@royalaid a subscription shouldn't ever return nil it will always return a ratom-ish thing that ratom-ish might contain a nil but it will never be a nil itself

royalaid03:02:51

hmmm then I better see where I am goofing 😄

dpsutton03:02:14

Are you generating subscriptions at runtime?

royalaid03:02:22

Nope, surely it is a basic mistake like double derefing or something

mikethompson07:02:35

@royalaid Do you have re-frame-10x installed?

mikethompson07:02:51

It can show you the value in each subscription

mikethompson07:02:24

re-frame-template will create an app with which you can experiment, maybe.