Fork me on GitHub
#re-frame
<
2021-11-30
>
NoahTheDuke15:11:47

following up on that, are there any guides/blogs about converting an existing reagent project to use re-frame, vs starting from scratch?

p-himik15:11:39

At its core, the process is rather simple: 1. Find a ratom that you consider to be a part of your app's state 2. Figure out the path where you'd put its value in the re-frame's app-db 3. Create an event that sets the value at that path 4. Replace all instances of reset! on that ratom with dispatch to that event 5. Create a subscription that retrieves the value at that path 6. Replace all instances of derefing the ratom with derefing the subscription 7. For all cursors, tracks, reactions, create its own subscription that uses the original one as a signal 8. Put all side-effects inside effects and use them within new event handlers to which you dispatch in place where old side-effects were originally There are some exceptions to the above, of course. Specifics highly depend on a particular case.

gratitude 2
💯 1
NoahTheDuke15:11:49

interesting, that makes sense

Drew Verlee19:11:48

What are some common stragies for a client handling a long request to the backend that might time out, but you want to re-try. I'm thinking we could just piggy back on re-frames/dispatch later function.

emccue19:11:24

like you want to retry after a timeout? Have an on-failure handler that checks the reason for the error and tries again

Drew Verlee03:12:33

> ike you want to retry after a timeout? Have an on-failure handler that checks the reason for the error and tries again This is what we ended up doing using dispatch-later