Hi,
we get a Syntax Error [0] when we try the following example [1] from https://github.com/apollostack/graphql-fragments
Are there any plan to supprt template string variables within gql queries?
Thanks,
Fabian
[0]
Error:(25, 3) Syntax Error GraphQL (25:3) Unexpected Name "__typename"
[1]
import gql from 'graphql-tag';
const query = gql`
query {
field {
...MyFragmentName
}
}
${fragment}
`;
Hi Mischi.
Thanks for using the plugin.
There is support for gql fragments as described in http://dev.apollodata.com/core/fragments.html
Will that work for you?
Yes, that worked perfectly in the past 馃憤. But if i understand https://github.com/apollostack/graphql-fragments correctly, they recommend the use of graphql-anwhere and to inline fragments directly with template string variables. So i'm wondering if that's something we can add support for too?
CC: @tmeasday
@stubailo Can you clarify whether this use case is the recommend approach for fragments going forward?
@jimkyndemeyer Updated guides and GitHunt example recommend this approach.
@jimkyndemeyer that's right - basically we didn't want people to have to use an additional function, and the interpolation approach allowed us to essentially pass "arguments" into gql.
This is fixed by https://github.com/jimkyndemeyer/js-graphql-language-service/issues/13 for the next release.
Most helpful comment
This is fixed by https://github.com/jimkyndemeyer/js-graphql-language-service/issues/13 for the next release.