-
-
Notifications
You must be signed in to change notification settings - Fork 637
feat(graphql): add asyncDeepEquals to the graphqlClient #1496
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
base: main
Are you sure you want to change the base?
Conversation
ebb3b2f
to
5188dd7
Compare
While Ci is running, can you please adjust the commit message according with https://github.com/zino-hofmann/graphql-flutter/blob/main/docs/dev/MAINTAINERS.md Thanks! |
5188dd7
to
821aa3b
Compare
Done, please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an asynchronous deep equality check to improve performance by offloading expensive synchronous operations to another isolate. The key changes include:
- Adding the asyncDeepEquals parameter to GraphQLClient and QueryManager.
- Updating rebroadcast methods and their invocations from synchronous to their asynchronous counterparts.
- Adjusting documentation and function names to reflect the async changes.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
packages/graphql/lib/src/graphql_client.dart | Added asyncDeepEquals parameter and updated rebroadcast calls. |
packages/graphql/lib/src/core/query_manager.dart | Introduced AsyncDeepEqualsFn and revised rebroadcast logic. |
packages/graphql/lib/src/core/observable_query.dart | Updated calls to the async rebroadcast method. |
@Neelansh-ns before jumping in the review, any comment on the copilot review? Thanks |
Accepted one suggestion, the other can be ignored. Added the reasoning in the reply to the suggestion. |
Cool, now the commit needs to be squashed by preserving the |
fix: add .ignore() to fire and forget Co-authored-by: Copilot <[email protected]>
7bb0d93
to
5d0b17b
Compare
Done! |
Hi @vincenzopalazzo, kindly review and let me know your thoughts. If all looks good, can we aim for pushing it to pub? |
Fixes / Enhancements
asyncDeepEquals
param to theGraphqlClient
as the DeepCollectionEquality is an expensive operation and was running synchronously. This in turn would result in a jank whenever there is a response received and the equality check happens in the_cachedDataHasChangedFor
function.compute()
to move the operation to a different isolate.