Fork me on GitHub
#re-frame
<
2016-09-18
>
shaun-mahood15:09:48

@yury.solovyov: Saw your conversation with @mikethompson in #reagent, I should be available off and on to help today if you run into any more problems.

yury.solovyov15:09:56

thanks, really appreciate it.

yury.solovyov15:09:48

@shaun-mahood how should I perform setting initial state? via action dispatch ?

yury.solovyov16:09:02

also, classic question: where to put async logic (io/ajax)

yury.solovyov16:09:10

in event handlers?

elahti16:09:02

@yury.solovyov i just use dispatch-sync to set up the initial state, before doing anything else

yury.solovyov16:09:47

yeah, that's ok I guess

yury.solovyov16:09:21

but where do you put the logic that requires some async stuff?

yury.solovyov16:09:35

I can imagine a case where some event that need to go on server, or perform io, is split in 2 parts: say, before fetch and after fetch

yury.solovyov16:09:59

I can set up a channel where I put "requests", dispatch event to start async stuff, and when It is finished I dispatch one more event with result that updates the state

yury.solovyov16:09:05

does that makes sense?

shaun-mahood16:09:55

@yury.solovyov: best resource is probably the "Populating your Application Data" section of the docs https://github.com/Day8/re-frame/blob/master/docs/README.md

shaun-mahood16:09:45

See if that helps and ask anything that isn't clear still.

yury.solovyov17:09:08

@shaun-mahood I don't get the thing about returning map as description of the effects, what shape should it have?

yury.solovyov18:09:31

@shaun-mahood how do I write -fx compliant API so that it can handle keys from returned map?

shaun-mahood18:09:39

@yury.solovyov: Glad the docs are helping :) There'a a lot to figure out in there and I'm pretty sure there are some parts that aren't quite done yet, so keep asking as you run into things.

yury.solovyov18:09:40

hope it is not too noizy

shaun-mahood18:09:21

Definitely not too noisy, keep up the questions :)

yury.solovyov18:09:12

I kinda have a mixed feelings about this: this is either very smart and cool stuff or it is overengineered, maybe cause I'm a beginner

shaun-mahood19:09:09

The effects and coeffects are pretty new, you can do without them if they are unnecessary - I think they're great but I was also able to build things without them.

shaun-mahood19:09:06

But it certainly doesn't hurt to get exposure to other ways to build things and see what clicks for you and for your needs.