Skip to content

Commit

Permalink
feat: attempt to call mutation callbacks from mutation method
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe authored and micimize committed Oct 30, 2019
1 parent 405ae24 commit e323a4d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/graphql/lib/src/core/query_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,24 @@ class QueryManager {
}

Future<QueryResult> mutate(MutationOptions options) {
return fetchQuery('0', options);
return fetchQuery('0', options).then((result) async {
// not sure why query id is '0', may be needs improvements
// once the mutation has been process successfully, execute callbacks
// before returning the results
final mutationCallbacks = MutationCallbacks(
cache: cache,
options: options,
queryId: '0',
);

final callbacks = mutationCallbacks.callbacks;

for (final callback in callbacks) {
await callback(result);
}

return result;
});
}

Future<QueryResult> fetchQuery(
Expand Down

0 comments on commit e323a4d

Please # to comment.