question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Select fragment as observable from the store

See original GitHub issue

Using 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
helfercommented, Aug 17, 2017

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!

0reactions
ntzioliscommented, Oct 16, 2020

Is this possible by now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Saving state with fragments - Android Developers
Generated when the fragment is created for the very first time. randomGoodDeed is saved to ensure that users see the same random good...
Read more >
Angular rxjs: Delay subscription till other Observable emits
I have 2 Subscription - one is a subscription of my ActivatedRoute and another from ngrx Store. ngOnInit ...
Read more >
Reading and writing data to the cache - Apollo GraphQL Docs
You can read and write cache data using GraphQL fragments on any normalized ... it first calls writeFragment to store our newComment data...
Read more >
Route Params with NgRx Store | Brian F Love
Using the withLatestFrom() RxJS operator we can access the selected route fragment from the store using the selectRouteFragment operator.
Read more >
Can I Use Media Fragments? / Sylvain Lesage - Observable
Media Fragments syntax seems very useful to store metadata about a media into the URL. For example, imagine I've run a face tracking ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found