-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Deduplicate generated imports * Generate changeset * Add comments; remove unnecessary imports
- Loading branch information
Showing
5 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': patch | ||
--- | ||
|
||
Don't generate duplicate imports for the same identifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/presets/near-operation-file/tests/fixtures/issue-6546-fragments.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export const usernameFragment = gql` | ||
fragment usernameFragment on User { | ||
username | ||
} | ||
`; | ||
|
||
export const userFields = gql` | ||
fragment userFields on User { | ||
...usernameFragment | ||
} | ||
${usernameFragment} | ||
`; |
27 changes: 27 additions & 0 deletions
27
packages/presets/near-operation-file/tests/fixtures/issue-6546-queries.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import gql from 'graphql-tag'; | ||
import { userFields, usernameFragment } from './issue-6546-fragments'; | ||
|
||
export const limitedUserFieldsQuery = gql` | ||
query user { | ||
user(id: "1") { | ||
...usernameFragment | ||
} | ||
} | ||
${usernameFragment} | ||
`; | ||
|
||
export const userAndFriendQuery = gql` | ||
query allUserFields { | ||
user(id: "1") { | ||
...userFields | ||
} | ||
friend: user(id: "2") { | ||
...usernameFragment | ||
} | ||
} | ||
${userFields} | ||
${usernameFragment} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters