-
-
Notifications
You must be signed in to change notification settings - Fork 120
Fragments: The superclass, '<name>FragmentMixin', has no unnamed constructor that takes no arguments #346
Comments
Hi @tuanvugoodmoney could you add some code from |
|
@tuanvugoodmoney I do not see here anything related to generated code... Where this error come from? |
This code import only two libraries |
I'll work on creating a new repo to reproduce the problem |
Thanks |
@vasilich6107 See this repository. My original project had analysis turned off for all generated graphql files so I didn't see compilation errors. In this new project, the generated graphql.graqhql.dart actually has a compilation error, see screenshot. In the same repo, you can see the user fragment generates normally. If you try to run the test, the original error referenced in this ticket shows up, due to compilation error. |
Thanks for your help |
Will try to address the issue this week |
Hi @tuanvugoodmoney |
For now I can only suggest you to write query getInquiryById($inquiryById: ID!) {
user {
inquiryBy(id: $inquiryById) {
__typename
... on Inquiry {
id
}
... on InquiryNotFoundError {
message
}
... on ServiceUnavailableError {
message
}
... on InquiryResumeFailedError {
message
}
}
}
} without using the fragment |
@tuanvugoodmoney you can also write like this to incorporate fragments query getInquiryById($inquiryById: ID!) {
user {
...User
}
}
fragment User on User {
inquiryBy(id: $inquiryById) {
__typename
... on Inquiry {
id
}
... on InquiryNotFoundError {
message
}
... on ServiceUnavailableError {
message
}
... on InquiryResumeFailedError {
message
}
}
} |
@jjoelson you can apply the workaround that I suggested in my previous comment |
@vasilich6107 Thank you for the quick response! I am able to work around it for now by restructuring my fragments. I might dive a bit into the Artemis code to see if I can figure out the issue, so I'll comment here if I find anything useful. |
This is also affecting me :( I have the nested fragment inside of an interface, and I get a similar Going to use the workaround to avoid the inner fragment, but it's definitely not as clean |
@cody1024d unfortunately there is no solution for now except the reorganizing fragments structure |
@vasilich6107 No problem. It is not the end of the world! Thank you for this awesome project! |
Any updates on this issue? I would like to use a shared mixin from a union to render a UI for all queries that return the data, so the workaround above results in a type error. Example:
We're using the same UI widget to show all insights. So the workaround posted results in the error UserMixin$InsightTab is not of type GameMixin$InsightTab. I was hoping to make the widget expect InsightTabMixin so both cases work. Is there a fix or other workaround I should try? |
Before reporting a bug, please test the beta branch!
Bug description
I have a fragment that with direct fields except __typename and a union. The fragment and query is generated successfully, but when I write a unit test, I get the following errors while loading the unit tests. The query and fragment runs successfully on Apollo Graph explorer.
Errors
Specs
Artemis version: 7.1.1-beta.1
build.yaml:
Artemis output:
GraphQL schema:
GraphQL query:
The text was updated successfully, but these errors were encountered: