Fork me on GitHub
#re-frame
<
2016-08-26
>
vikeri10:08:25

I bet this has been discussed before, pardon my ignorance, I did not find anything in the wiki nor the docs. My question is regarding 0.8.0. The new subscription model is beautiful but I have one use case I’m not sure if it can accomodate: edit: will add snippet instead

mikethompson10:08:35

(reg-sub
  :user/full
  (fn [[_ user-id] _]
     [(subscribe [:users user-id] 
       (subscribe [:user-settings user-id])])
  (fn [[users user-settings] [_ user-id]]
    (merge 
        users
        user-settings)))

vikeri10:08:13

@mikethompson: Great! And outstanding work on re-frame! A pleasure to work with!

mikethompson10:08:39

Good to hear 🙂

vikeri10:08:09

Another question: could I somehow use subscriptions as input, say that I had to get user-id from (subscribe [:user-id]) instead of from the subscription call?

mbertheau10:08:15

vikeri the re-frame wiki calls that dynamic subscriptions, see there 🙂

mbertheau10:08:00

should be the second argument to the first fn in reg-sub

vikeri10:08:34

Ok! The wiki is not updated to 0.8.0 on that part, but maybe that is still how it should be done?

mbertheau10:08:39

but I don't really know, just the dynamic subscription thing 🙂

mbertheau10:08:08

well, everything from 0.7.0 is still in 0.8.0, just register-sub has been renamed to reg-sub-raw

vikeri10:08:42

Alright thanks!

shaun-mahood14:08:25

@yogthos: I added memory-hole to the re-frame wiki external resources page https://github.com/Day8/re-frame/wiki/External-Resources

manutter5119:08:39

Kind of a noob question: I’m using Bootstrap 4 with reagent/re-frame, and I want to use a button group as a dropdown menu. If I just naively plug in the code from the Bootstrap docs, it doesn’t drop down, which I assume is because Bootstrap js code isn’t expecting to talk to React. So I’m doing the re-frame approach of firing events, setting a flag in the app-db, and having the menu contents show or hide based on the flag. That all works, but it seems labor intensive. Is there a better way?

velveteer19:08:41

@manutter51 I suppose it is subjective, but you don't have to put everything into app-db. you could still leverage a simple ratom to handle that component state, assuming it's not needed anywhere else in the app

shaun-mahood19:08:17

@manutter51: Have you taken a look at how re-com does things? Might give you some ideas - https://github.com/Day8/re-com/blob/master/src/re_com/dropdown.cljs

manutter5119:08:51

Ah, re-com has a dropdown? I’ll have to check that out, I looked at the library once upon a time but it’s been a while. Thanks!

manutter5121:08:47

It’s after 5:00 on a Friday after a long week, and an hour ago I decided to move a db column out of one table and into another for better data normalization. Now it’s a little less than an hour later, and I’ve moved the column, updated the migrations, updated all affected SQL queries, updated all the AJAX endpoints, updated all the re-frame event handlers and the UI components, and tested it, and everything works.

manutter5121:08:14

Did I mention I FREAKIN LOVE working in Clojure/CLJS/reagent/reframe?

shaun-mahood21:08:25

@manutter51: Best feeling ever 🙂

manutter5121:08:58

The only downside is this nagging feeling I’m gonna get caught — it’s so much fun, it’s like this has got to be against the rules somehow