Fork me on GitHub
#re-frame
<
2015-09-26
>
bbss09:09:32

Is it so that regular printing doesn't work anymore when using the trace-forms macro?

mccraigmccraig16:09:28

so i have some components which need to trigger differently parameterized instances of the same api call, and update the app-db with the results. currently i have two separate pairs of call/receive handlers which do this, and the knowledge of how to derive the app-db path to store the results at is in those handlers. this is leading to a profusion of identical-apart-from-result-path-derivation handlers. i would like to reduce code duplication with a better abstraction, but i can't immediately see a good way. how are other people dealing with this ?

darwin16:09:17

@mccraigmccraig: I’m not sure if I understand well, a code sample would be better, I think you have several options: 1) extract shared functionality into plain function and both handlers should call it with their particular parameters, or 2) register one handler which will have that parametrization encoded in its event parameters (you can have two helper functions for creating such events with a pre-baked parameter), or 3) use middleware which will deal with app-db path, then register two handlers using two instances of this parametrizable middleware, re-frames’s own path middleware does something like this

danielcompton19:09:35

@darwin’s right on here, you can pass custom parameters into a subscription, you don’t need to just dispatch [:event-1] and [:event-2]

hkjels20:09:58

I think Re-frame deserves a proper, flashy introduction site

hkjels20:09:24

is it being worked on?

mikethompson23:09:11

@hkjels: not being worked on. I lack the design gene.