Fork me on GitHub
#re-frame
<
2020-08-08
>
mikethompson01:08:17

@franklineapiyo You might have to use a React component for your table @grant.isom Assuming that HTTP work is done by something like re-frame-http which is is an effect So what you do is to overwrite the effect handler so it does nothing

Franklin05:08:09

Thanks @U051MTYAB react-table it is then!

mikethompson01:08:38

So the "event handler" would still produce the effect (please do this HTTP work), but the effect which would normally action that work wouldn't be mocked out to not actually do it

mikethompson01:08:03

Maybe: also see re-frame-test ? Not that it provides a solution to the exact problem you raise, but it might be adjacent to your requirements. BTW, to mock an effect handler just registering a new effect handler using reg-fx replacing the previously registered effect handler

dpsutton01:08:59

Anyone know of any work towards integrating dev cards and reframe?

mikethompson03:08:21

@dpsutton It is not straight forward because of the global state in re-frame Some have worked out a way to break through that via various hacks ... but I'm not sure what they are

mikethompson03:08:29

Perhaps the easiest way is to isolate the views themseleves from re-frame itself. Ie. do the subscriptions in an "outer" component, and pass in data and callbacks to an inner component, which is re-frame free

mikethompson03:08:06

Then the inner component is re-frame free (just Reagent) and that can be plonked into devcards.

mikethompson03:08:22

But this is all theory from me. I've never done it for real

dpsutton04:08:50

Yeah. Looking at that now. Not sure how it will work out in real life but just seeing if there was anything better

genekim07:08:39

Another fun discovery, when I accidentally created an endless dispatch cycle — very obvious in the graph! 🙂

thelittlesipper21:08:56

Not sure if something like this already exists, but I made a couple lightweight macros for decoupling Re-frame subscriptions from Reagent Form-1 component-functions. I've been using them pretty successfully for a couple months now, so I thought I'd share. There's a gif in the readme that I think demonstrates the use-case + usage well. https://github.com/sansarip/peanuts

thelittlesipper22:08:09

‘twas interesting indeed! At any rate, please do let me know if you have any further questions/comments/concerns if you do decide to use Peanuts!