You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A thing that i like to do is to concat the OperationName to my query:
exportconstOPERATION_NAME='MyQuery';constquery=gql` query ${OPERATION_NAME} { whatever { foo bar } }`;
That way, I can export the operation name along with the query and when i need to use it with the refetchQueries parameters of Apollo I have a direct link between the code that ask for a query to refetch and the query itself.
That works well with graphql-tag, but when I use graphql-tag.macro instead, it crashes at runtime.
The operation name doesn’t seem to be properly concatenated to the query source code before it is passed to graphql-tag and is handled like fragments are handled. I tried to debug it and to find a fix, but my understanding of how babel internals works is lacking too much to be able to fix it.
The fix would be to figure out a way to determine if an expression is just a string and not another compiled ast and to add it to the query source before we pass it to graphql-tag.
The text was updated successfully, but these errors were encountered:
A thing that i like to do is to concat the OperationName to my query:
That way, I can export the operation name along with the query and when i need to use it with the
refetchQueries
parameters of Apollo I have a direct link between the code that ask for a query to refetch and the query itself.That works well with
graphql-tag
, but when I usegraphql-tag.macro
instead, it crashes at runtime.The operation name doesn’t seem to be properly concatenated to the query source code before it is passed to graphql-tag and is handled like fragments are handled. I tried to debug it and to find a fix, but my understanding of how babel internals works is lacking too much to be able to fix it.
The fix would be to figure out a way to determine if an expression is just a string and not another compiled ast and to add it to the query source before we pass it to
graphql-tag
.The text was updated successfully, but these errors were encountered: