-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Expose useFragment
from Apollo client core as watchFragment
#11348
Comments
Hi @vigie 👋 Likewise, it was great to see you and @alvaro450 at Summit! Thanks for opening this issue. I'd like to look at whether a thin wrapper around |
OK, thanks. When you have time I would like to understand better why you think this would not be an appropriate feature to add to core itself. |
Appreciate your patience, @vigie - the team is aligned that we'd like to make this a core API. I don't have a timeline for you yet, but I'll transfer this issue over to our Apollo Client repository to avoid creating a new issue there. Thanks! |
Great news thanks @alessbell, let us know if we can help it along |
Hi @vigie 👋 I've got a draft PR open here #11465 and just cut a release you can try out with There are a couple more tests and docs I'll need to add there before moving it out of draft, but it's ready for anyone to try out (you'll see the PR also swaps out the internals of the React |
Hi @alessbell thanks for the update, unfortunately I haven't had a lot of time to work on GQL stuff recently, but will definitely get back to this at some point and will let you know. Excited to try out the pattern that this will enable for us. |
The ability to watch fragments would be very helpful throughout our application. I'm looking forward to implementing more elegant solutions to a variety of cache issues we've encountered, and hoping @alessbell's PR is released soon. Thank you for your work on apollo-angular! |
Hi @jmcmichael 👋 CIViC looks like a fascinating project, thanks for sharing! It's always so interesting for our team of maintainers to see the places Apollo Client is being used out in the world :) If you'd like to try |
Excellent, thank you! I'll check out the update and give |
Folks on this thread may also be interested to follow my PR kamilkisiela/apollo-angular#2226 over on the apollo-angular repo that adds Since |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
|
Hi @alessbell 👋 it was good meeting you at Summit this week. Myself and @alvaro450 spoke with you about the following. Tagging @benjamn also as suggested:
TL;DR We (VMware) are an Angular shop. We need equivalent functionality to the React
useFragment
hook. Can this be back ported into core as something equivalent towatchQuery
exposing an observable via avalueChanges
property?Why?
As you know,
useFragment
is a highly valuable feature, ideally it should be available for use by all frameworks.In our use case, we currently pair components with queries. These queries are often highly similar but not quite identical. This leads to narrow cache misses and lots of redundant fetching at the data layer. We can solve this by pushing the queries up the hierarchy to smart container components that compose queries from fragments exported by descendant components (a pattern we were exposed to at Summit this week), but we don't want to do this if it results in the need for prop drilling.
watchFragment
- a way to retrieve an observable of just the relevant fragment directly from the client, would solve this.Prior Art/Discussion
Lots of history here and I'm sure more that I am unaware of. Here is a similar feature request open and closed in 2017 before
useFragment
became a thing.Thanks for your consideration (we'd be happy to work on this if appropriate).
The text was updated successfully, but these errors were encountered: