Description
I need to use tristate optionals for my mutations and ran into invalid code generation when enabling it.
I recreated the issue in a simple project.
The generated test.var.gql.dart
contains errors as it's mixing up the imports when using the tristate classes.
import 'package:ferry_test/__generated__/serializers.gql.dart' as _i1;
import 'package:gql_tristate_value/gql_tristate_value.dart' as _i2;
...
b..name = const _i2.AbsentValue();
...
if (_$namevalue case _i1.PresentValue(value: final _$value)) {
In some lines it uses the correct import _i2
for the tristate value, in other it's wrong leading to syntax errors.
I haven't figured out what causes this issue as it's not present in all cases.
In the example project you can comment out the Pokemons
query in lib/test.graphql
and the code generation works as expected. But when both query and mutation are present the code is broken.
The same problems also occured in the generated schema files in a larger project when modifying that, with no obvious correlation between the changes in the schema and the mixing of imports.