Fork me on GitHub

@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 ?


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


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


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


@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).


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.


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.


Question about navigation, for anyone who's thought about it. What does this add to Secretary's routing?


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


@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.


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.


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

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


So no usage of app-db, basically.


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.


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


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.


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.


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


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


Cool, that'd be great


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


That's fantastic


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


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.


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


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


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


@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.


@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.


@shaun-mahood So you’re the re-frame guy?! Wow. Well I’ve pinned it for now. But, using 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).


@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 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 🙂


@shaun-mahood That’s mental. 😉


@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.


@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?