Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues with Graphql Fragments #556

Closed
NeutronScott12 opened this issue Aug 18, 2018 · 2 comments · Fixed by #553
Closed

Having issues with Graphql Fragments #556

NeutronScott12 opened this issue Aug 18, 2018 · 2 comments · Fixed by #553

Comments

@NeutronScott12
Copy link

NeutronScott12 commented Aug 18, 2018

export const MESSAGE_FRAGMENT = gql`
	fragment MessageFragment on Message {
		id
		parentId
		body
		author {
			username
			avatar_url {
				url
			}
		}
	}
`


export const SHOW_CHANNEL_QUERY = gql`
	query ShowChannelQuery($channelId: ID!) {
		showChannel(channelId: $channelId) {
			id
			name
			slug
			messages {
				...MessageFragment
			}
		}
	}
	${MESSAGE_FRAGMENT}
`

Works fine with querying, but when I try to generate types I get a error saying unknown fragment.

@evans
Copy link
Contributor

evans commented Aug 23, 2018

Thanks for reporting the issue! Definitely need to get this solved. The issue here is that our current query extraction looks for the gql` and doesn't perform any string interpolation. We'll need to add that. My first thought is some AST magic. Do you have any ideas on tools to use for that sort of work?

@marcosfede
Copy link

@evans

I'm still unable to use fragments on version 2.18.0

Unknown fragment "teamDraftInfo"
ToolError: Validation of GraphQL query document failed

should this be working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants