On Monday, March 28, 2016 at 4:13:39 PM UTC-4, Luke Horton wrote:
> Why does the re-frame framework restrict a 1:1 between dispatches and 
> handlers?
> 
> At first I found it a little weird. I can think of lots of realistic cases 
> where:
> 
> ```
> some event happens -> module a responds; module b responds;
> ```
> 
> Then I thought... well, if one module has a handler that changes the app-db, 
> every other module only needs to subscribe to the same query, and they won't 
> ​*need*​ to also handle that event, it will happen reactively:
> 
> ```
> some event -> module a responds (change db value) -> module b reacts to 
> change;
> ```
> 
> But then I remembered that very frequently I need to handle this behavior:
> 
> some event -> module a responds (starts fetching new data) ... eventually 
> updates db;
> 
> Which I can't seem to fit into the paradigm of 1:1 handler to event.
> 
> If we only have a 1-handler per event restriction, how can I also have:
> 
>  some event -> capture event in module a (start fetching new data);   ???   ; 
>  capture event in module b (start fetching a different set of data); 
> 
> Receiving the data would be relatively straightforward ... dispatch separate 
> events (from a receiving chan) for [:a-data] and [:b-data], but how we 
> implement in a decoupled manner the initial "go get data" across different 
> modules is lost on me.
> 
> Any suggestions / patterns for solving this would be helpful.

Thanks for the link Chris. I've actually read over this wiki link before, but 
didn't think about it too hard. I was hoping I wouldn't have to make drastic 
changes to the infrastructure to handle my particular use, but it seems that 
might be the case. If I'm going to essentially write my own messaging bus that 
handles dynamic subscriptions and many to many handlers, I should probably just 
not bother with re-frame. The other quirk that kind of bothers me is how each 
handler defines its own middleware. I tend to think of middleware as an 
application-wide orthogonal offering for logging, debugging, reporting, etc. I 
don't like the idea of having to manually insert middleware for each and every 
handler, even if I generate a middleware factory.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to