Fork me on GitHub
Petrus Theron05:09:48

I would like to write re-frame components where their data requirements are defined as subscriptions that will trigger a fetch (via dispatch) if it misses the cache. Otherwise, return the cached value. In the past I have fought with parameterised subscriptions, so I'm not sure this is a good idea. Has anyone tried this, or thought about it more?


I’ve handled that in the app state. If the app state has any data present for that specific key, then I don’t fetch any data. I do that check in the handler. This is an example, but not sure if it is exactly what you were looking for


Wouldn’t it be great to have reagent/reframe implemented in cljx so we can easily and performantly run it server side?


@danielcompton: interesting. Sadly, Hiccup is vulnerable to XSS (unless you explicitly escape), so, I’d rather estay away from it. I suppose a compiler from reagent’s template to hiccup could generate code that is not open to XSS.


danielcompton: reagent’s is k, but hiccup is not.


I’m not sure how that’s relevant to server side rendering though?


danielcompton: that blog post you pointed to is using hiccup on the server side, actual hiccup, not reagent’s.


gotcha, been a while since I read that post


I actually have it working by executing JS on the server… I just don’t like the performance.