-
Notifications
You must be signed in to change notification settings - Fork 177
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
When including a document node with sub fragments in gql tag include all fragments #125
Comments
Apologies for brevity, on my phone.
You need to interpolate the fragment B and C in your initial definition of
fragment A, too. The document needs the interpolated value of all the
fragments you're using.
…On Wed, Sep 27, 2017 at 5:04 PM Kenneth Bambridge ***@***.***> wrote:
Say I have a fragment *A* which has two fragments *B* and *C*
*fragmentA.gql*:
fragment A {
...B
items {
...C
}
}
which I import like so:
import fragmentA from './fragmentA.gql'
if I use fragment A in query D like so:
export const queryD = gql`query getSomeAlphabet { id ...A}${fragmentA}`
The document node queryD only has 2 definitions, the getSomeAlphabet
query and *A* but not the definitions for *B* and *C*.
Is this a bug, or am I doing something wrong here?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#125>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ABERRhypusNUGveC3R67NLYe6h_GTqTHks5smuKPgaJpZM4Pmjkf>
.
|
Thanks @jnwng for the quick response. I forgot to include in the original fragment, but there are two |
Ah, yes. If you have the webpack loader set up properly I'd expect the
#import statements to include the definitions for those fragments into the
document. I'd double check that that is actually happening - maybe check
what's in fragment A when you're defining query D. Might be something up
with the imports.
…On Wed, Sep 27, 2017 at 5:12 PM Kenneth Bambridge ***@***.***> wrote:
Thanks @jnwng <https://github.com/jnwng> for the quick response. I forgot
to include in the original fragment, but there are two #import statements
pulling in the other fragments that are used. Is that what you were
referring to?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#125 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABERRqskowosCCLbe4t_ezA2HKHsOo2Iks5smuRSgaJpZM4Pmjkf>
.
|
I logged the equivalent of |
The way I got around this was to make a separate |
Ah, yes now I recall that there's an issue interpolating fragments that are
loaded via the webpack loader. Glad you figured it out!
…On Wed, Sep 27, 2017 at 6:12 PM Kenneth Bambridge ***@***.***> wrote:
The way I got around this was to make a separate .gql file for queryD and
#import fragmentA
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#125 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABERRpsDkyr9gL3dx8xxnBzxPG1YIMtsks5smvKJgaJpZM4Pmjkf>
.
|
i believe this is resolved by #105 and has to do with how we serialize stuff using the webpack loader. |
Say I have a fragment A which has two fragments B and C
fragmentA.gql:
which I import like so:
if I use fragment A in query D like so:
The document node
queryD
only has 2 definitions, thegetSomeAlphabet
query and A but not the definitions for B and C.Is this a bug, or am I doing something wrong here?
The text was updated successfully, but these errors were encountered: