-
Notifications
You must be signed in to change notification settings - Fork 33
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
chore: update graphql dependency and use features #144
base: main
Are you sure you want to change the base?
Changes from 5 commits
5eec158
b1b0877
292af4c
b91d35c
2431869
dc961c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ environment: | |
sdk: ">=2.18.0 <4.0.0" | ||
|
||
dependencies: | ||
graphql: ^5.1.3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please, let's not upgrade to beta versions unless there is a very good reason for it |
||
graphql: ^5.2.0-beta.9 | ||
|
||
# Nhost packages | ||
nhost_dart: ^2.0.7 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,18 +25,54 @@ import '../nhost_graphql_adapter.dart'; | |
/// requests made by the Nhost APIs, which can be useful for proxy configuration | ||
/// and debugging. | ||
/// {@endtemplate} | ||
/// | ||
/// {@template nhost.graphqlClient.defaultPolicies} | ||
/// [defaultPolicies] (optional) customizes the default policies used by the | ||
/// client. This can be used to change the cache-and-network or network-only | ||
/// behavior of the client. | ||
/// {@endtemplate} | ||
/// | ||
/// {@template nhost.graphqlClient.alwaysRebroadcast} | ||
/// [alwaysRebroadcast] (optional) if true, the client will rebroadcast watch | ||
/// queries when the underlying cache changes. This is false by default. | ||
/// {@endtemplate} | ||
/// | ||
/// {@template nhost.graphqlClient.deepEquals} | ||
/// [deepEquals] (optional) overrides the default deep equals comparison for | ||
/// caching. | ||
/// {@endtemplate} | ||
/// | ||
/// {@template nhost.graphqlClient.deduplicatePollers} | ||
/// [deduplicatePollers] (optional) if true, the client will deduplicate | ||
/// duplicate pollers. This is true by default. | ||
/// {@endtemplate} | ||
/// | ||
/// {@template nhost.graphqlClient.queryRequestTimeout} | ||
/// [queryRequestTimeout] (optional) overrides the default request timeout for | ||
/// queries. This is 10 seconds by default. | ||
/// {@endtemplate} | ||
GraphQLClient createNhostGraphQLClient( | ||
NhostClientBase nhostClient, { | ||
GraphQLCache? gqlCache, | ||
Map<String, String>? defaultHeaders, | ||
http.Client? httpClientOverride, | ||
DefaultPolicies? defaultPolicies, | ||
bool? alwaysRebroadcast, | ||
DeepEqualsFn? deepEquals, | ||
bool? deduplicatePollers, | ||
Duration? queryRequestTimeout, | ||
}) { | ||
return createNhostGraphQLClientForAuth( | ||
nhostClient.gqlEndpointUrl, | ||
nhostClient.auth, | ||
gqlCache: gqlCache, | ||
defaultHeaders: defaultHeaders, | ||
httpClientOverride: httpClientOverride, | ||
defaultPolicies: defaultPolicies, | ||
alwaysRebroadcast: alwaysRebroadcast, | ||
deepEquals: deepEquals, | ||
deduplicatePollers: deduplicatePollers, | ||
queryRequestTimeout: queryRequestTimeout, | ||
); | ||
} | ||
|
||
|
@@ -52,12 +88,28 @@ GraphQLClient createNhostGraphQLClient( | |
/// {@macro nhost.graphqlClient.defaultHeaders} | ||
/// | ||
/// {@macro nhost.graphqlClient.httpClientOverride} | ||
/// | ||
/// {@macro nhost.graphqlClient.defaultPolicies} | ||
/// | ||
/// {@macro nhost.graphqlClient.alwaysRebroadcast} | ||
/// | ||
/// {@macro nhost.graphqlClient.deepEquals} | ||
/// | ||
/// {@macro nhost.graphqlClient.deduplicatePollers} | ||
/// | ||
/// {@macro nhost.graphqlClient.queryRequestTimeout} | ||
/// | ||
GraphQLClient createNhostGraphQLClientForAuth( | ||
String nhostGqlEndpointUrl, | ||
HasuraAuthClient nhostAuth, { | ||
GraphQLCache? gqlCache, | ||
Map<String, String>? defaultHeaders, | ||
http.Client? httpClientOverride, | ||
DefaultPolicies? defaultPolicies, | ||
bool? alwaysRebroadcast, | ||
DeepEqualsFn? deepEquals, | ||
bool? deduplicatePollers, | ||
Duration? queryRequestTimeout, | ||
}) { | ||
return GraphQLClient( | ||
link: combinedLinkForNhostAuth( | ||
|
@@ -67,5 +119,10 @@ GraphQLClient createNhostGraphQLClientForAuth( | |
httpClientOverride: httpClientOverride, | ||
), | ||
cache: gqlCache ?? GraphQLCache(), | ||
defaultPolicies: defaultPolicies, | ||
alwaysRebroadcast: alwaysRebroadcast ?? false, | ||
deepEquals: deepEquals, | ||
deduplicatePollers: deduplicatePollers ?? false, | ||
queryRequestTimeout: queryRequestTimeout ?? const Duration(seconds: 5), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dbarrosop would it be much better to increase the request timeout for it let's say 1 or 3 mins to avoid unexpected timeouts when devs updates to the new version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: the 5 seconds was taken from the default value of the dep itself There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another side note: we should probably wait for this PR to be merged then update the |
||
); | ||
} |
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.
please, let's not upgrade to beta versions unless there is a very good reason for it