How to pass nested fragments
baconcheese113 opened this issue · 2 comments
If I have a query and fragments like below
query Home {
user {
id
...fragment1_user
}
}
fragment fragment1_user on User {
__typename
id
firstName
...fragment2a_user
...fragment2b_user
}
fragment fragment2a_user on User {
__typename
id
lastName
}
fragment fragment2b_user on User {
__typename
id
email
}
When I try to pass the props to their child widgets inside the Fragment1
Widget:
Fragment2aWidget(userFrag: widget.userFrag),
Fragment2bWidget(userFrag: widget.userFrag),
I get the following errors:
The argument type 'Fragment1UserMixin' can't be assigned to the parameter type 'Fragment2aUserMixin'.
The argument type 'Fragment1UserMixin' can't be assigned to the parameter type 'Fragment2bUserMixin'.
From the Home to Fragment1 widgets I see I'm able to pass Home$Query$User
to the Fragment1UserMixin
type, but I can't pass the others. I could probably just cast to the child mixin types, but that prevents static analysis on the values I'm passing in.
Am I missing something?
Look at how the code is generated.
As far as I understand- it’s mostly relates to how dart type system work.
Maybe you’ll be able to find suitable approach
It appears like the runtimeTypes aren't changing, that's preventing passing nested fragments farther down the widget tree