Fork me on GitHub
#re-frame
<
2016-10-26
>
shem09:10:53

@andre i have in-frame re-frisk working nicely in a re-frame app, but the popup only shows the greeting, no data. any pointers?

shem10:10:09

@andre never mind, solved it. was using a relative path in :script-path.

curlyfry12:10:09

Okay, a sanity check:

limist14:10:44

@mikethompson Any plans to for more documentation on re-frame subscriptions please? The description on the main README.md doesn't match the new coolness in 0.8.0 as described in the CHANGES.md, and the commentary in the suggested todomvc file https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs isn't enough (for me at least). Something in the style of the new docs at https://github.com/Day8/re-frame/tree/master/docs would be great.

limist14:10:16

In particular, suppose one has a bunch of pre-0.8.0 subscriptions, that now all use the new reg-sub-raw; and they all wrap their return value in (reaction...). If one now uses the 0.8.0 reg-sub that does not return a ratom, is that generally ok? Does reg-sub automatically wrap the computation like before, watching the inputs for changes? But/and if reg-sub returns a regular value, then how do potential further nodes in the signal graph know when to update? etc etc.

shaun-mahood15:10:20

@limist: I definitely think there needs to be some more documentation on subs, if nobody else tackles it before me then I will probably start working on them over the next few weeks.

limist16:10:03

@shaun-mahood Great to hear, thanks!

limist16:10:07

Another question: I'd like to have an interceptor that, once activated/registered somehow, is added to all event handlers in my application, without explicitly modifying those event handlers individually. e.g. imagine something like the debug interceptor but it only needs to be specified somewhere once, to start working app-wide (instead of tweaking a ton of individual event handlers). Is there a way to do that please?

shaun-mahood16:10:38

@limist: I've not done this myself, but I believe that in the past the suggestion was to write your own wrapper function and use that instead of reg-event-db. If it doesn't work well for you it might be worth checking with @mikethompson once he's on to see if there's a better method. So something along the lines of

(defn reg-my-event-db [id db-handler]
      (re-frame/reg-event-db id my-interceptors db-handler))
Though that code hasn't been tested at all, so there might be some issues with it.

limist16:10:52

@shaun-mahood Yes thanks, saw that approach in the docs at https://github.com/Day8/re-frame/blob/master/docs/Interceptors.md#wrapping-handlers I'm hoping there's a way to auto-inject an interceptor in all events without touching individual handlers, so it's easier to turn on/off some universal behavior, app-wide.

shaun-mahood16:10:54

@limist: You can still turn on or off universal behavior from your function later on (or have your function do it contextually if that makes sense), but I'm not sure of a way that prevents having to touch the handlers at least once without wrapping or overriding the reg-event-db and similar functions.

sllyq17:10:35

Is there a way not to lose focus on input when state from subscription updates?

curlyfry18:10:31

@limist I've gone with the wrapping approach, and it worked very well. I can turn on/off the universal behaviour from the wrapper function. Changing all the handlers to the new one didn't take too long.

limist19:10:03

@curlyfry Thanks for the tip, I'm willing to do it, it just seems so...heavy-handed. ๐Ÿ™‚ Especially when there must already be some built-in way to add extra interceptors on any/every event handler.

shaun-mahood19:10:52

@sllyq: Do you have any example code showing the problem you're having?

reefersleep19:10:19

@limist @curlyfry @shaun-mahood : I talked to @mikethompson about this issue recently and he said to hand roll a wrapper fn. Worked fine for me ๐Ÿ˜Š

limist19:10:01

@reefersleep Dang, I would've liked meta-burrito over regular-burrito. But so be it.

shaun-mahood19:10:32

@limist: I think I know what you should name your wrapper function now ๐Ÿ™‚