Fork me on GitHub
#re-frame
<
2016-08-27
>
shyambalu17:08:35

guys any nice way to do loading in re-frame?

shyambalu17:08:22

per component loading

shyambalu17:08:37

so I don’t have to keep writing loading handlers for each component

shaun-mahood21:08:08

@shyambalu: Could you post an example of what you’re doing now? Should make it a little easier to help.

shyambalu21:08:32

@shaun-mahood: something like this login handler -> makes ajax call -> sets loading true in app db login response handler (gets called from successful ajax response) -> sets loading false in app db

shyambalu21:08:57

need a way to abstract this out

shyambalu21:08:50

and separate parts of the app and be loading simultaneously so can’t only have one loading state in app-db

shaun-mahood23:08:20

@shyambalu: If you’re using v0.8.0, there are some things that should help in the new docs - https://github.com/Day8/re-frame/tree/master/docs - particularly the sections on effectful handlers and populating your application data. If things are still unclear or you have any specific questions please ask - we’re trying to get the documentation as good as we can so any areas of confusion will still help. If you’ve already been through those docs and they didn’t help, let me know and I will see if I can come up with a more specific response or an example.

shyambalu23:08:15

@shaun-mahood yep that looks perfect

shyambalu23:08:34

although we are stuck at the previous version for the moment

shyambalu23:08:48

but i’m starting to think more and more it’s worth the effort

shaun-mahood23:08:15

@shyambalu: I think so - it seems like it solves a lot of the issues I’ve run into from earlier. Is your code base pretty big?

shyambalu23:08:15

not that big 50,000 LOC

shaun-mahood23:08:56

Big enough to make it a pain to change though I bet. If you don’t have any re-frame middleware, I think you should be able to update to the new version reasonably easily (change register-sub to reg-sub-raw, register-handler to reg-sub-db) - but I guess we should add a section to the docs specifically on how to update to v0.8.0 with some examples.