Fork me on GitHub

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


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


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


That's true. You may also be interested in this discussion:

👍 8

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.


@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


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

👍 4

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


@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


@lkowarschick The “use fragment” setting is probably the biggest factor in avoiding page reloads


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

 (fn [{:keys [db]} [_ data]]
   {:db db
    :dispatch [::clear-fields]}))
But don't know the best way to dispatch multiple.




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?


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


There is a wrapper I’ve written. You should take a look at it.