Fork me on GitHub
#re-frame
<
2019-09-04
>
danielstockton10:09:32

Does the rf/path interceptor implicitly create a layer 3 subscription?

p-himik11:09:15

Interceptors are all about events, and events are completely independent from subscriptions. So to answer your question - no, it does not.

4
danielstockton12:09:06

Indeed, thanks. It could be useful for namespacing subscribers under a key in state.

p-himik12:09:48

That's true. You may also be interested in this discussion: https://github.com/Day8/re-frame/issues/137

šŸ‘ 8
eskemojoe00715:09:16

Simple architecture question. I've made a lot of low level events like :clear-field or :set-field for a simple web form. I have larger events such as :success-submit that needs to clear fields and change other values. It seems redundant to change the db for the fields in multiple locations, but also sending other dispatches from events gives me a lot of events. Not sure if a lot of events is a bad thing.

Lu19:09:41

@david.folkner Oh man! This was basically me some months ago šŸ˜‚! I came up with a super thin easy to integrate library that Iā€™m already using in production for two clients projects :).. if it suits your use case, itā€™s a life saver have a look https://github.com/luciodale/fork

eskemojoe00719:09:40

Looks interesting, but I wanna learn the guts for now, so I'm making it myself!

šŸ‘ 4
Leon15:09:39

hey! whats the best way to do routing with re-frame? i already use secretary (as used in the template), but my question is mainly how i can navigate between pages without causing page reloads using that setup

manutter5116:09:02

@david.folkner Event dispatching isnā€™t too expensive, unless you have a bunch of interceptors. Iā€™d probably start out by dispatching the events as needed, and only optimizing if I saw a problem

manutter5116:09:39

@lkowarschick The ā€œuse fragmentā€ setting is probably the biggest factor in avoiding page reloads

eskemojoe00716:09:19

Thanks. What's the simplest way to disptach multile events from an event. I'm used to something like

(rf/reg-event-fx
 ::create-success
 (fn [{:keys [db]} [_ data]]
   {:db db
    :dispatch [::clear-fields]}))
But don't know the best way to dispatch multiple.

dpsutton16:09:17

:dispatch-n

eskemojoe00716:09:23

How do I do it with things like http-xhrio :on-success? Or is it better to create an event like ::success with the proper dispatches?

manutter5116:09:40

Are you using re-frame/http-fx? It lets you just supply an event to dispatch for the :on-success key, which works well.

scknkkrer16:09:58

There is a wrapper Iā€™ve written. You should take a look at it. https://github.com/LeaveNhA/suluk