Fork me on GitHub

Has anyone used Apollo with reframe?


on my last project, I used apollo alongside re-frame. apollo dealt with fetching data and re-frame dealt with UI state


Do you know of any code references publicly available? I think it’s pretty straight forward but would love to see how someone else did it.


I open sourced a very early draft of an integration with reagent and apollo-client


the idea is to wrap the apollo-client observable in a Reaction and then return that


you can probably use that as a starting point


Awesome. Thank you. I’ll take a look sometime tomorrow. I’m seeing if I can convince the start up I am on to switch to cljs. Key things I need is Material design and Apollo and the switch will likely be pretty easy.


Wondering if anyone here might have any guidance/tips on dynamic subscriptions. I have tried to stay away from them for a while after reading in the docs that they are bad. It isn't clear now though if that's the case. Best I can see now you can have dynamic subs which take another sub as an arg? What about a dynamic sub that takes a none re-frame/reagent atom/reaction?


@jon693 I haven't had any problems with them, and use them all the time. I'd stick to just passing paths though, not instances of subscriptions or atoms. It is hard to give good advice on it, because you kind of have to make guesses about what parts of the app-state/subscription structure graph are unlikely to change. (The ones that won't are the ones that are unlikely to cause problems when referred to in dynamic subscriptions).


cool, thanks for the response!


I'm usually wanting it for something like tracking a set of selected ids


then when I want to render some indication of that I'm on the fence about passing the subscribed set down the tree and just check if each id is in it or create a sub where I pass the id and do that in the rf handler


dynamic sub for each view that is


which also just creates a bunch more subs and makes my 10x bloated...


Oh, I guessed wrong - I thought you were worried about the problems dynamic subs might cause if you overuse them and then want to refactor. For performance, I've had a similar situation to what you are describing (I think). I made a dynamic subscription (A) that used another subscription (B), where B computed something (like a map) that made it so A was trivial to compute. Still a good amount of subs, but each was quick. Not sure if that is applicable in your case, hard to say without knowing what is involved.