Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an API to watch fragments #4223

Open
Tracked by #2331
jpvajda opened this issue Jun 24, 2022 · 1 comment
Open
Tracked by #2331

Provide an API to watch fragments #4223

jpvajda opened this issue Jun 24, 2022 · 1 comment

Comments

@jpvajda
Copy link
Contributor

jpvajda commented Jun 24, 2022

Relates to

apollographql/apollo-client#8236
apollographql/apollo-feature-requests#198

Details

This relates to our work in our webClient to offer a useFragment hook, and there has been some interest in this same level of functionality in Kotlin.

useFragment is a read-only reactive/live binding into the cache, providing an always-up-to-date view of whatever data the cache currently contains for a given fragment.

It makes sense to want to watch just a fragment but it's not possible in Kotlin at the moment; it looks like our watcher functions are restricted to queries only.

@jpvajda jpvajda changed the title Provide a UseFragment hook in Kotlin Provide a UseFragment hook in Kotlin Jun 24, 2022
@martinbonnin martinbonnin changed the title Provide a UseFragment hook in Kotlin Provide an API to watch fragments Jun 24, 2022
@jpvajda
Copy link
Contributor Author

jpvajda commented Jul 5, 2022

From a discussion I had with the requester of this feature:

There is sort of a work around where you can create a getFoo(uuid: ID!): Foo query then have the cache know how to lookup that entity even if it came in a list. But would be nice to have it as a first class concept and it seems like it could be possible given things are already effectively stored this way in the normalized cache.

@martinbonnin martinbonnin changed the title Provide an API to watch fragments Provide an API to watch fragments Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants