-
In the update functions I often create fragments for using them in I'm wondering whether there is an option not to specify fragment name when using in cache updates? I've seen I've found that here underscore symbol is used as a fragment name, but I'm getting warning from |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Basically this restriction only exists in GraphQL Tag and what they were meaning to do is disallow fragments from being created that accidentally have the same name in the same query. However, it's completely fine to create some fragments that have the same name if they're not being used in the same query. So the solution here would be that you could also just use It's also possible however to call |
Beta Was this translation helpful? Give feedback.
-
Thanks, using |
Beta Was this translation helpful? Give feedback.
Basically this restriction only exists in GraphQL Tag and what they were meaning to do is disallow fragments from being created that accidentally have the same name in the same query. However, it's completely fine to create some fragments that have the same name if they're not being used in the same query.
So the solution here would be that you could also just use
parse
from'graphql'
. It depends on your use-case, hence we've used that placeholder name in the example snippets.It's also possible however to call
disableFragmentWarnings
fromgraphql-tag
to prevent these warnings: https://github.com/apollographql/graphql-tag/blob/fbbb02e53de7e8a9a9d849ed2ee306d4d0599bfb/src/index.js#L176