Bug? DuplicateFragmentName on typescript-react-query #5925
Unanswered
jonathanstanley
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Beta Was this translation helpful? Give feedback.
5 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Have been using this all for a while and working well, but today found an DuplicateFragmentName error:
Error: Validation error of type DuplicateFragmentName: There can be only one fragment named 'MetadataDetails' @ 'MetadataDetails':
I tried to setup a codesandbox and made a little progress, but after spending a couple hours trying to recreate the environment, i'm hoping these details will suffice.
When I use a query that has nested multiple-uses of the same fragments, the query tries to include the fragment multiple times. In the example below,
Group
hasUser
, and BOTH haveMetadata
. When I query Group, I wantMetadata
for bothGroup
andUser
. Instead of reusing the fragment, the generated code is repeating the fragment for each. Example belowdocument:
but when I use the generated code, the HTTP request has a query like this
note the duplicate MetadataDetails
the repeated inclusion causes the DuplicateFragmentName error
update from my later post
Here is the problem showing in codesandbox with a generic example ( a blog post with an author and comments from other authors)
Beta Was this translation helpful? Give feedback.
All reactions