This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-08
Channels
- # announcements (1)
- # babashka (18)
- # beginners (32)
- # calva (3)
- # chlorine-clover (4)
- # cider (14)
- # clj-commons (24)
- # clj-kondo (1)
- # clojure (34)
- # clojure-europe (4)
- # clojure-filipino (1)
- # clojure-uk (4)
- # clojuredesign-podcast (2)
- # clojurescript (6)
- # conjure (3)
- # core-async (2)
- # datahike (1)
- # datomic (3)
- # emacs (3)
- # esprit (20)
- # fulcro (4)
- # graalvm (11)
- # helix (13)
- # honeysql (4)
- # jobs (1)
- # lumo (1)
- # observability (4)
- # off-topic (11)
- # other-lisps (6)
- # pathom (6)
- # re-frame (13)
- # reagent (1)
- # reitit (1)
- # shadow-cljs (26)
- # web-security (2)
- # xtdb (10)
@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
Thanks @U051MTYAB react-table it is then!
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
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
@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
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
Then the inner component is re-frame free (just Reagent) and that can be plonked into devcards.
But this is all theory from me. I've never done it for real
Yeah. Looking at that now. Not sure how it will work out in real life but just seeing if there was anything better
Another fun discovery, when I accidentally created an endless dispatch cycle — very obvious in the graph! 🙂
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
‘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!
‘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!