diff --git a/examples/pokemon_explorer/test/dangling_reference_test.dart b/examples/pokemon_explorer/test/dangling_reference_test.dart index 95679ed9..9efaf4a5 100644 --- a/examples/pokemon_explorer/test/dangling_reference_test.dart +++ b/examples/pokemon_explorer/test/dangling_reference_test.dart @@ -50,7 +50,7 @@ class _MyWidget extends StatelessWidget { } void main() { - testWidgets("test description", (WidgetTester tester) async { + testWidgets("skips dangling references", (WidgetTester tester) async { final client = Client( cache: Cache(possibleTypes: possibleTypesMap), link: Link.function((request, [forward]) { @@ -93,5 +93,9 @@ void main() { expect(find.widgetWithText(ListTile, 'name0'), findsOneWidget); expect(find.widgetWithText(ListTile, 'name1'), findsNothing); expect(find.widgetWithText(ListTile, 'name2'), findsOneWidget); + + await tester.runAsync(() { + return tester.pump(Duration.zero); + }); }); } diff --git a/examples/pokemon_explorer/test/timer_test.dart b/examples/pokemon_explorer/test/timer_test.dart index 2d4a5a02..2e9b14c4 100644 --- a/examples/pokemon_explorer/test/timer_test.dart +++ b/examples/pokemon_explorer/test/timer_test.dart @@ -39,6 +39,9 @@ void main() { }, ); await tester.pumpWidget(_MyWidget(client)); + await tester.runAsync(() { + return tester.pump(Duration.zero); + }); }, variant: policies, ); diff --git a/packages/ferry/lib/src/request_controller_typed_link.dart b/packages/ferry/lib/src/request_controller_typed_link.dart index a989a1f1..83457ad9 100644 --- a/packages/ferry/lib/src/request_controller_typed_link.dart +++ b/packages/ferry/lib/src/request_controller_typed_link.dart @@ -69,7 +69,7 @@ class RequestControllerTypedLink extends TypedLink { /// Temporarily add a listener so that [prev] doesn't shut down when /// switchMap is updating the stream. final sub = prev?.listen(null); - scheduleMicrotask(() => sub?.cancel()); + Future.delayed(Duration.zero, () => sub?.cancel()); }, ).switchMap( (req) { diff --git a/packages/ferry/pubspec.yaml b/packages/ferry/pubspec.yaml index e41b7871..7bbf8e42 100644 --- a/packages/ferry/pubspec.yaml +++ b/packages/ferry/pubspec.yaml @@ -12,7 +12,7 @@ topics: - ferry dependencies: gql: '>=0.14.0 <2.0.0' - rxdart: ^0.27.1 + rxdart: ^0.28.0 gql_link: '>=0.5.0 <2.0.0' gql_exec: '>=0.4.0 <2.0.0' meta: ^1.3.0 diff --git a/packages/ferry/test/client/json_operation_test.dart b/packages/ferry/test/client/json_operation_test.dart index 0e73a580..90017808 100644 --- a/packages/ferry/test/client/json_operation_test.dart +++ b/packages/ferry/test/client/json_operation_test.dart @@ -15,18 +15,21 @@ void main() { addTearDown(client.dispose); - final req = - JsonOperationRequest(operation: Operation(document: gql.parseString(r''' + final req = JsonOperationRequest( + operation: Operation(document: gql.parseString(r''' query Reviews { reviews(episode: $episode, first: $first, offset: $offset) { id stars } - }''')), fetchPolicy: FetchPolicy.CacheFirst, vars: { - 'episode': 'NEWHOPE', - 'first': 3, - 'offset': 0, - }); + }''')), + fetchPolicy: FetchPolicy.CacheFirst, + vars: { + 'episode': 'NEWHOPE', + 'first': 3, + 'offset': 0, + }, + ); final result = await client.request(req).first; diff --git a/packages/ferry_cache/lib/src/utils/operation_root_data.dart b/packages/ferry_cache/lib/src/utils/operation_root_data.dart index 561f67eb..33ecdd90 100644 --- a/packages/ferry_cache/lib/src/utils/operation_root_data.dart +++ b/packages/ferry_cache/lib/src/utils/operation_root_data.dart @@ -13,8 +13,8 @@ Map operationRootData( ) { final fieldNames = operationFieldNames( request.operation.document, - request.operation.operationName!, - (request.vars as dynamic).toJson(), + request.operation.operationName, + request.varsToJson(), typePolicies, possibleTypes, ); diff --git a/packages/ferry_cache/pubspec.yaml b/packages/ferry_cache/pubspec.yaml index 985a62c2..42b64535 100644 --- a/packages/ferry_cache/pubspec.yaml +++ b/packages/ferry_cache/pubspec.yaml @@ -12,7 +12,7 @@ topics: dependencies: ferry_exec: ^0.6.1-dev.1 meta: ^1.3.0 - rxdart: ^0.27.1 + rxdart: ^0.28.0 normalize: ^0.9.1 ferry_store: ^0.6.0-dev.0 collection: ^1.15.0 diff --git a/packages/ferry_hive_store/pubspec.yaml b/packages/ferry_hive_store/pubspec.yaml index e8eeee7e..83960b4e 100644 --- a/packages/ferry_hive_store/pubspec.yaml +++ b/packages/ferry_hive_store/pubspec.yaml @@ -13,7 +13,7 @@ topics: dependencies: hive: ^2.0.0 ferry_store: ^0.6.0-dev.0 - rxdart: ^0.27.1 + rxdart: ^0.28.0 collection: ^1.15.0 dev_dependencies: test: ^1.16.8 diff --git a/packages/ferry_store/pubspec.yaml b/packages/ferry_store/pubspec.yaml index 55cf3320..0ab09de2 100644 --- a/packages/ferry_store/pubspec.yaml +++ b/packages/ferry_store/pubspec.yaml @@ -10,7 +10,7 @@ topics: - gql - ferry dependencies: - rxdart: ^0.27.1 + rxdart: ^0.28.0 collection: ^1.15.0 dev_dependencies: test: ^1.16.8 diff --git a/packages/ferry_test_graphql2/lib/queries/books.graphql b/packages/ferry_test_graphql2/lib/queries/books.graphql new file mode 100644 index 00000000..bec02696 --- /dev/null +++ b/packages/ferry_test_graphql2/lib/queries/books.graphql @@ -0,0 +1,14 @@ + + + +query GetBooks { + books { + title + ... on Textbook { + courses + } + ... on ColoringBook { + colors + } + } +} \ No newline at end of file diff --git a/packages/ferry_test_graphql2/pubspec.yaml b/packages/ferry_test_graphql2/pubspec.yaml index 2afb83bd..8df21b30 100644 --- a/packages/ferry_test_graphql2/pubspec.yaml +++ b/packages/ferry_test_graphql2/pubspec.yaml @@ -19,6 +19,6 @@ dev_dependencies: pedantic: ^1.11.0 built_value_generator: ^8.1.1 dart_style: ^2.3.2 - ferry_generator: + ferry_generator: ^0.12.0 diff --git a/packages/normalize/lib/src/utils/operation_field_names.dart b/packages/normalize/lib/src/utils/operation_field_names.dart index 5a22fe9c..eb426fff 100644 --- a/packages/normalize/lib/src/utils/operation_field_names.dart +++ b/packages/normalize/lib/src/utils/operation_field_names.dart @@ -10,7 +10,7 @@ import 'package:normalize/src/policies/type_policy.dart'; /// Returns the root field names for a given operation. List operationFieldNames( DocumentNode document, - String operationName, + String? operationName, Map vars, Map typePolicies, Map> possibleTypes,