Select fragment as observable from the store
See original GitHub issueUsing Apollo for Angular 2, I’m trying to find a way to reactively select entities from the cache/store. It’s basically readFragment
but as an observable (watchFragment
maybe?). watchQuery
will not work as I don’t want to watch an actual query.
As far as I could tell readFragment
only enables a single immediate lookup into the store, not an observable result. I tried looking into the ApolloStore, but could only find the getState
and dispatch
, no select
or similar.
Am I missing something? 😃
Edit: I’m certain this would be possible by using my own NgRedux store and just select data from that, but I’m wondering whether there’s a way to select directly through Apollo (internally it must happen somehow).
Edit 2: I’ve achieved this with a “custom” NgRedux store and it works perfectly. However, I still think watchFragment
would be a valid addition to Apollo 😃
Edit 3: So, it actually does not work perfectly like this, because I’m only getting the entity itself from the store, not any related entities that might exist on the fragment.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:10 (4 by maintainers)
Top GitHub Comments
Ok, great! I’m not sure what the latest state is of the new store API that you’d have to write against, but maybe @jbaxleyiii can fill us in!
Is this possible by now?