Fork me on GitHub
#re-frame
<
2018-10-31
>
abdullahibra12:10:45

is it okay for call one dispatcher from another dispatcher then get the db updated then use it ?

ingesol13:10:20

@abdullahibra A code sample would probably help here 🙂

abdullahibra13:10:10

@ingesol it's fixed by passing a tag to the dispatcher

drewverlee21:10:53

Is it possible and advisable to use subscriptions outside the context of a view? to say, react to some data being updated?

Wilson Velez21:10:44

pros and cons of using re-frame-simple?

mikerod21:10:24

@drewverlee > Is it possible and advisable to use subscriptions outside the context of a view? to say, react to some data being updated? don’t think its a good idea

mikerod21:10:38

and if it isn’t happening during reagent render, you’d not get automatic watchers registered I believe

mikerod21:10:04

but there probably are alternative ways to do what you want, just not sure the specifics enough

mikerod21:10:11

“what” needs to react?

drewverlee22:10:55

well, im basically trying to use it like a subscription. Sometimes it feels easier to just point at the point of change, rather then all the places that could change it and all the ways it could be changed.

drewverlee22:10:42

you might have a dozen hooks to a piece of state, but if u just want to be notified about when it changes, it seems odd to burden them all rather then right a post update hook to report the change. but if its not idiomatic, there are probably good reasons, even if im not sure i see them.

mikerod22:10:48

There are some interceptor approaches probably. And a few built in re-frame that perhaps you should consider

drewverlee22:10:32

ah, are the subscription, reaction functions tied to the dom in some way?

drewverlee22:10:25

your right, this should be a interceptor. which im not sure i can do easily either. my last hope then, just be explicit 🙂

mikerod22:10:44

They aren’t tied to dom but reagent wraps a “context” around render and that’s how subscriptions (reagent reactions really) are registered as watchers which makes them reactive.

mikerod22:10:36

Pretty sure that hold directly for re-frame subscriptions use of reactions too

mikerod22:10:00

Interceptors do sound like potentially what you want though

mikerod22:10:37

You can see some in the re-frame.std-interceptors ns

lumpy22:10:52

any good workarounds to not have to use stopPropagation?

lumpy22:10:23

Does stopPropagation go against the re-frame way?

dpsutton22:10:43

seems to be very reframey to me? stop the click propagation and put it into reframe events

lumpy22:10:40

It’s not very pure, the view is now controlling the event propagation

lumpy22:10:42

I was thinking to make a special dispatch that dispatched the event then called stopPropagation, but I don’t know if that is just hiding what is going on.

manutter5122:10:01

I wouldn't worry to much about it, it's basically an artifact of the underlying JS.

manutter5122:10:39

From a different perspective, you could say that calling stopPropagation in your event handler is actually preventing side effects.

4
manutter5122:10:30

but any way you look at it, your event handler is wrapping the underlying JS event model, so it's never going to be perfectly pure.

dpsutton22:10:58

I'd want nothing that knew about reframe to have a click event in it. Do that as near the Dom as you can and leave it behind

âž• 4
metal 4