Fork me on GitHub
#re-frame
<
2016-09-14
>
superstructor00:09:44

@si14 I’d be interested to know the use case for requiring the whole db vs just having another reg-sub to pull what you needed out of the db and make it available as something more specific than :db ?

danielcompton00:09:31

The thing that I think about is how can we turn re-frame into a library, where it doesnt’ depend on global state

martinklepsch09:09:41

@danielcompton I think that would be great. Is there a discussion that outlines requirements/to suggest approaches

si1410:09:36

@superstructor can it be the case that you were going to reply to lwhorton? :)

curlyfry10:09:51

@mikethompson: Hi, does the debug middleware/interceptor in 0.6 and 0.8 work differently? I don't get the nice cljs-devtools formatting with 0.6 debug (which we still use at work for the moment).

curlyfry11:09:17

Think I found it: (defn log [& args] ((:log default-loggers) (apply str args))). I'll just write my own debug middleware until we upgrade to 0.8, it's pretty minimal anyway.

coyotespike15:09:41

I was just reading the re-frame docs after a few months away. Holy crap Mike has added a lot, with his trademark excellent writing. I'm still wrapping my head around reg-event-db and reg-event-fx and reg-fx and reg-cofx - last time I used it we didn't have effect handlers.

coyotespike15:09:01

Question about navigation, for anyone who's thought about it. What does this add to Secretary's routing? https://github.com/Day8/re-frame/blob/master/docs/Navigation.md

coyotespike15:09:55

Is it the ability to have a different sub-`app-db`? Should this pattern be used in conjunction with Secretary?

shaun-mahood15:09:38

@coyotespike: They're kind of separate concerns - you could use Secretary or an alternative (silk, bidi, etc.) to route to any one of those panels, or have the panel update your current URL when you go to it, but it really doesn't affect your URL routing at all.

shaun-mahood15:09:54

Have you used Secretary at all with re-frame? I'm thinking of experimenting with URL routing as an effect on top of my normal events, as I wasn't super happy having URL navigation as the driver when I tried to integrate Secretary with a re-frame app last year.

coyotespike15:09:51

Yes, I've used Secretary and re-frame like so:

(secretary/defroute "/contact-info" []
  (session/put! :current-page #'contact-info))

coyotespike15:09:19

So no usage of app-db, basically.

coyotespike15:09:51

I guess I can see that we could display a different panel/view just by using re-frame. This wouldn't update our URL, necessarily.

shaun-mahood15:09:45

You can also have it so that when you display your new panel you update the URL as well - that's sort of the route I went down, but I ran into issues trying to get consistent results between navigating to a URL and typing it in

coyotespike15:09:18

But surely we can just use Secretary to route to and display a different view? I feel like I'm being a little think but I don't yet see how the concerns are separate. Seems like both Secretary and re-frame can display a different panel - but only re-frame could manage states more in-depth in a larger app, but Secretary more easily updates the URL.

shaun-mahood15:09:33

I think there's a better URL story hiding in there somewhere though and I'm hoping to get to it in the next few months.

coyotespike15:09:57

Your concern is sort of that we have two sources of control, our app-db and Secretary?

shaun-mahood16:09:31

A little bit - I'm going to try to write something a little more detailed and coherent for us to discuss.

coyotespike16:09:57

Cool, that'd be great

shaun-mahood16:09:27

@coyotespike: Tried it out as a slack post for the first time - should give a bit better starting point to discuss at least.

coyotespike17:09:31

That's fantastic

coyotespike17:09:14

This, combined with a closer look at how the ToDoMVC example is using Secretary with the app-db, helps a lot.

coyotespike17:09:21

I think I also tried setting the hash manually, as it were, and gave up and just used vanilla Secretary. I never thought much about coordinating with app-db state. That's a really interesting issue.

shaun-mahood17:09:13

@coyotespike: Yeah, I found it a lot more difficult than I expected.

coyotespike17:09:54

I'd be really interested if you make any further progress on it...I'll noodle on it going forward as well 🙂

nidu18:09:58

Hello. Is it ok that when i make sub like this (reg-sub :users/new-levels (fn [a] (:new-levels a))) i get nil if (:new-levels a) is empty, but if i use (reg-sub :users/new-levels :new-levels) - i get [:users/new-levels]? This statement doesn't hold when returned object is not nil

gamecubate20:09:07

@shaun-mahood Thanks for this post. Great read and an addition to my stack of cljs "importants”. Wishing there was an actual blog post URL for this though. Would be added to bookmarks and pocket as well.

shaun-mahood20:09:18

@gamecubate: I want to get something more meaningful put together before adding it to the re-frame docs - I could throw it up on the wiki in the meantime I guess. I feel like a bit of a jerk throwing it out there with "here are some problems, no good solution yet" though.

gamecubate20:09:24

@shaun-mahood So you’re the re-frame guy?! Wow. Well I’ve pinned it for now. But, using http://getpocket.com to store key stuff (a no-no I know as it wasn’t designed for that… hem… funny how “not designed for” doesn’t stop people from using a product in ways unintended but that better meet their needs…), I’ll be on the lookout for such. Would print this (if I could).

shaun-mahood20:09:17

@gamecubate: Nope, I've just started helping with docs and such recently. I use pinboard for to store stuff like that and it works well. Started a repo at https://github.com/smahood/re-frame-url-fx so you can bookmark it - I even managed to get a typo in on my first word so it won't set up any unrealistic expectations 🙂

gamecubate20:09:03

@shaun-mahood That’s mental. 😉

superstructor21:09:48

@shaun-mahood: we've got a bidi and pushy solution in our 0.8 based re-frame app. We've solved some of these problems and come across others. Some of it is nice, and some pretty ugly that needs improvement to be honest. I'd like to decouple it from our commercial app into an independent open source dependency but haven't had time yet.

shaun-mahood22:09:12

@superstructor: That sounds great - any chance of writing up some thoughts on the good and bad things and how you would want them to be different?