Fork me on GitHub
#re-frame
<
2017-12-03
>
mikerod01:12:25

@hiskennyness I’ve just used react-bootstrap. It lets you control the component state so it’s fairly trivial to tie into re-frame. Then again I guess baking-soda has a broader range of bootstrap support at this point. I just haven’t taken the leap to try it.

kennytilton02:12:10

Thanks, all! I just want to get a handle on re-frame, so I think I will pass on modals. Interesting to see Bootstrap in all the suggestions… Hang on, it just occurred to me to check google closure: https://google.github.io/closure-library/source/closure/goog/demos/dialog.html Any reason CLJS frameworks do not roll that in wherever possible?

Oliver George08:12:11

Lots of the goog ui stuff is quite stateful. That means it's lifecycle can be difficult to map into React components.

Oliver George08:12:15

We tried bootstrap's modal js stuff. It worked but ultimately went for a solution designed for use in react apps.

Oliver George08:12:20

I'm sure everyone ends up with a different solution. We loved blueprintjs for other reasons so used their dialog component too.

Oliver George08:12:15

IMHO dialogs are a pain. If you're getting a handle on re-frame I'd say steer clear and do more typical things.

Oliver George08:12:18

React is for SPAs. SPAs try and make a browser more like an app but rich UI stuff like modal dialogs etc are fiddly in a browser.

danielneal13:12:11

Nice! That app diff on event gonna be super useful

souenzzo17:12:59

How to add a cofx after the "main" handler?

shaun-mahood18:12:51

@U2J4FRT2T: you could add them into effects and they should be available for the rest of the interceptor chain.

souenzzo20:12:35

The problem: I have a function that transform DB into url/path. Then I want to always that DB change, call this to update the url. Where I put it?

shaun-mahood03:12:10

Are you trying to set the URL route? Or trying to navigate to another URL that then fires a new event?

kennytilton17:12:14

Ok, looks like we’re goin’ with the spreadsheet metaphor. Here is Sean Parent on Adobe Adam’s “Property Model”: https://youtu.be/4moyKUHApq4?t=20m55s

shaun-mahood18:12:16

Hoplon uses the spreadsheet metaphor quite a bit - there's a lot of conceptual overlap with re-frame there too.

shaun-mahood18:12:38

I kind of like it as a metaphor except for the immediate negative reaction based on years of business excel use.

kennytilton16:12:04

Yes, and indeed I posted to the wrong channel and meant to post to #hoplon (where I had been whining that no one understood me when I used the spreadsheet metaphor — or responded that Excel was buggy <g>).

shaun-mahood22:12:40

Well, I'm glad you did - I put that video on my list to watch later. I think the spreadsheet model applies just as well (or just as poorly) to re-frame subscriptions too, so it wasn't that noticeable of a mispost 🙂

kennytilton22:12:44

Right. I saw the bit of re-frame doc saying roughly “everyone uses the spreadsheet metaphor….” so I felt better. But most people just say, “Why would I want to write a spreadsheet program?“. When enough smart people do that I start looking for a different analogy!

kennytilton19:12:35

I am playing with todo-mvc and decided to block duplicate todo’s, offering a simple js/alert (via a new :user-error effect) that the todo duplicates ID whatever. That went fine, but the event handler (following the spec) clears the input field after dispatching :add-todo (which, again, I have modified to reject dups). Commonly we allow users to correct mistakes by editing the erroneous value vs forcing a complete retyping. My emerging understanding of re-frame makes me think there is no alternative other than to move the validation into the handler so it knows not to clear. Is there some trick I am missing, or are event handlers where input validation should control app behavior? I guess the trick in this case is that the view needs variable handling based on what happens to the todo, so we need the data to flow to the view (and, yes, I contemplated a “transaction-outcome” property but it struck me as too event-ish for declarative views).

richiardiandrea20:12:32

Is there a way to use re-frisk for normal Cljs maps? Basically like an html transformer for maps?

jeaye23:12:11

I have some component using react-native-animatable for pulsing text. It pulses fine on the first render, but then doesn't pulse when I change the text. Is there an idiomatic re-frame approach to handling this?

(defn helper-text [message]
  [animatable/text {:animation :bounce
                    :style {:font-size 16
                            :text-align :center
                            :color theme/alternate-text-color}}
    message])

jeaye23:12:49

Whenever message changes, thus the data returned from helper-text changes, I'd like to kick off the animation.

jeaye23:12:26

I suppose this is more of a reagent question, actually. As I haven't found any animation-specific re-frame libraries, the only way re-frame can likely help here is by keeping some extra state around, listening for when the animation finishes, to clear the state, and then determining when it should start again, by setting that state. That's a lot of additional logic on the event side of things though.

jeaye23:12:16

More in line with my mental model is [animatable/text {} "foo"] is different from [animatable/text {} "bar"] so it'll mount and render, thus triggering the animation again. Seems like it only mounts once and then just changes the text displayed, which is optimal, but a pain in this instance.

danielcompton23:12:11

yeah you might be able to trigger it to re-render by derefing ratoms in the right places

danielcompton23:12:20

It seems more like a use case for form-3 components though

jeaye23:12:43

@danielcompton Yep, in the process of cooking up a form-3 now.