Apollo-tooling: flow target fails on gql literals containing comments

Created on 29 Nov 2017  路  8Comments  路  Source: apollographql/apollo-tooling

Upgrading from 0.17.2 to 0.18.0 caused this gql literal to be left out of codegen:

gql`
query UserProfileView {
  me {
    id
    uuid
    # TODO https://app.asana.com/0/52068106376728/221203365474362
    role
  }
}
`

Copying that same query into a .gql file works as expected. Removing the comment line also works as expected.

馃悶 bug

All 8 comments

Thanks for pointing this out -- the regex to filter out gql strings that are entirely commented out is also filtering this out. It needs to do a better job differentiating between the two cases

there were cases where people would comment out gql queries entirely using // so the regex was changed to not match when a / was encountered -- but that was naive and we can do better :)

@lewisf thanks for working on this. I just installed 0.18.1 and unfortunately this report is still not working.

I see there's a good fixture https://github.com/apollographql/apollo-codegen/pull/313/files#diff-e923fb6197e1a8119dadbb034b9c8d8f in the test suite, but it doesn't appear to test that the query is included. When I put that const query in a JSX file in my repo, it isn't picked up by the codegen. If I take all / out of the comments then it works fine.

@martijnwalraven could we get another release? i think this fix was missed in the last release :( i must have landed it right after.

@lewisf: Just published 0.18.2!

thanks @martijnwalraven!

@turadg can you give 0.18.2 a shot?

I'm not on that codebase anymore. @rgoldfinger might.

I can confirm that it works on our codebase with that comment now. Thanks @lewisf!

Was this page helpful?
0 / 5 - 0 ratings