Skip to content

Commit

Permalink
fix(graphql): onComplete callback should send null
Browse files Browse the repository at this point in the history
  • Loading branch information
budde377 committed Mar 12, 2023
1 parent 32040ee commit aceff15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CC_CHANGELOG=dart pub global run changelog_cmd
default: analyze check

dep:
dart pub global activate melos;
dart pub global activate melos 2.9.0;
# dart pub global activate changelog_cmd;
$(CC) bootstrap

Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/lib/src/core/query_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:gql/ast.dart';
import 'package:graphql/client.dart';
import 'package:meta/meta.dart';

typedef OnQueryComplete = FutureOr<void> Function(Map<String, dynamic> data);
typedef OnQueryComplete = FutureOr<void> Function(Map<String, dynamic>? data);

typedef OnQueryError = FutureOr<void> Function(OperationException? error);

Expand Down Expand Up @@ -366,7 +366,7 @@ class QueryCallbackHandler<TParsed> {
if (options.onComplete != null) {
return (QueryResult? result) {
if (!result!.isLoading && !result.isOptimistic) {
return options.onComplete!(result.data ?? {});
return options.onComplete!(result.data);
}
};
}
Expand Down

0 comments on commit aceff15

Please # to comment.