Closed aquadesk closed 2 years ago
Hello guys,
I am using graphql_flutter: ^5.0.2-beta.6 this version.
I tried beta.7 but I get build errors so I could not try beta.7.
Expected behavior
The last line is to return correct cache
Future<QueryResult<MutationCreateProductReview>> createProductReview({ required String productName, String? desc, int? rating, List<String?>? images, }) async { var result = await client.mutateCreateProductReview( OptionsMutationCreateProductReview( variables: VariablesMutationCreateProductReview( productName: productName, desc: desc, rating: rating, images: images, ), update: (cache, result) { final queryResult = cache.readQuery(currentQueryOptions.asRequest); // << this line to return correct cache
I run this in iOS simulator
This fails. meaning queryResult becomes null
queryResult
Future<QueryResult<MutationCreateProductReview>> createProductReview({ required String productName, String? desc, int? rating, List<String?>? images, }) async { var result = await client.mutateCreateProductReview( OptionsMutationCreateProductReview( variables: VariablesMutationCreateProductReview( productName: productName, desc: desc, rating: rating, images: images, ), update: (cache, result) { final queryResult = cache.readQuery(currentQueryOptions.asRequest);
While, this works well. queryResult this has cache.
Future<QueryResult<MutationDeleteProductReview>> deleteProductReview({ required String id, }) async { var result = await client.mutateDeleteProductReview( OptionsMutationDeleteProductReview( variables: VariablesMutationDeleteProductReview( id: id, ), update: (cache, result) { final queryResult = cache.readQuery(currentQueryOptions.asRequest);
Sorry I digged in and found that my code has a bug. Sorry!
Hello guys,
I am using graphql_flutter: ^5.0.2-beta.6 this version.
I tried beta.7 but I get build errors so I could not try beta.7.
Expected behavior
The last line is to return correct cache
I run this in iOS simulator
Other useful/optional fields
This fails. meaning
queryResult
becomes nullWhile, this works well.
queryResult
this has cache.