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

Relay-style useFragment hook #1372

Open
satvikpendem opened this issue Aug 25, 2023 · 0 comments
Open

Relay-style useFragment hook #1372

satvikpendem opened this issue Aug 25, 2023 · 0 comments
Labels
enhancement New feature or request Priority: Low Low priority, would be cool to include inside the next release PRs encouraged PRs are welcome if stakeholders want to take ownership
Milestone

Comments

@satvikpendem
Copy link

Is your feature request related to a problem? Please describe.
I am currently using the graphql_flutter package for GraphQL in my Flutter application. However, I've used Relay before in React and I like its philosophy of compiling fragments into a full query so that the application never over or underfetches data. It uses a useFragment hook to do so. This feature allows components to specify their data requirements and automatically subscribe to updates to the fragment data.

Describe the solution you'd like
I would like to see the addition of a useFragment hook or a similar feature in the graphql_flutter package. This feature should allow Flutter components to specify their data requirements using GraphQL fragments. The components should then be automatically subscribed to updates to the fragment data. If the data for the specified fragment is updated anywhere in the app, the component should automatically re-render with the latest updated data.

Describe alternatives you've considered
While there are other GraphQL packages available for Flutter, none of them seem to offer a feature similar to Relay's useFragment hook. I have not been able to find something similar.

There's a good article on the benefits of a Relay style approach over the more popular Apollo approach, and even Apollo is creating their own useFragment hook and implementation, as well as the team behind GraphQL codegen designing a similar approach too.

@satvikpendem satvikpendem added the enhancement New feature or request label Aug 25, 2023
@vincenzopalazzo vincenzopalazzo added PRs encouraged PRs are welcome if stakeholders want to take ownership Priority: Low Low priority, would be cool to include inside the next release labels Aug 25, 2023
@vincenzopalazzo vincenzopalazzo added this to the v5.2.0 milestone Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority: Low Low priority, would be cool to include inside the next release PRs encouraged PRs are welcome if stakeholders want to take ownership
Projects
None yet
Development

No branches or pull requests

2 participants