Error when fragments are separated
See original GitHub issueCurrently when fragments are stored separately from queries and mutations, the codegen produces a “Unknown fragment …” error.
Example:
fragment.ts
import gql from 'graphql-tag';
export const userInfo = gql`
fragment UserInfo on User {
id
name
email
}
`;
query.ts
import gql from 'graphql-tag';
import { userInfo } from './fragment.ts';
export const userQuery = gql`
query UserQuery($id: ID!) {
user(id: $id) {
...UserInfo
}
}
${userInfo}
`;
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:15 (3 by maintainers)
Top Results From Across the Web
21. Sentence Errors: Fragments and Run-Ons
Run-on sentence consist of multiple complete sentences that have been incorrectly joined or not properly separated. There are two types of run-on sentences: ......
Read more >android - Fragments within Fragments - Stack Overflow
This is caused because the the container for FragmentNumber3 has been duplicated and it no longer has a unique ID. The initial Fragment...
Read more >Sources of Error in Gel Electrophoresis - Sciencing
This method involves the migration of fragments of DNA through a gel, where they are separated on the basis of size or shape....
Read more >Fragment transactions - Android Developers
The FragmentTransaction method detach() detaches the fragment from the UI, destroying its view hierarchy. The fragment remains in the same state ...
Read more >Comma Splices and Run-On Sentences - Research Guides
The following are very common mistakes related to punctuation usage (or lack of usage) ... and you need something a little stronger to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@LawJolla In 1.0.7 we fixed that, now you’ll get a more readable error with the missing fragment name. If you are still having issues, please open a new issue because this one is closed and outdated.
I’m getting this error. Version 1.0.6 with 1.0.6 versions of typescript and typescript-react-apollo
Works
Returns
codegen.yml
Thanks for the amazing work!