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
Copy file name to clipboardExpand all lines: docs/source/data/fragments.mdx
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,18 +41,6 @@ query GetPerson {
41
41
42
42
Changes to the `NameParts` fragment automatically update the fields included in any operations that use it. This reduces the effort required to keep fields consistent across a set of operations.
43
43
44
-
## Unique fragment names {#unique-names}
45
-
46
-
Fragment names must be unique across your entire application. If you reuse a fragment name, the `graphql-tag` library warns about the conflict at runtime to help prevent bugs:
47
-
48
-
```text
49
-
Warning: fragment with name SomeFragment already exists.
50
-
graphql-tag enforces all fragment names across your application to be unique; read more about
51
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names
52
-
```
53
-
54
-
As a best practice, use descriptive, component-scoped fragment names (like `ItemFragment` or `UserProfileFragment`) to avoid name collisions.
55
-
56
44
## Example usage
57
45
58
46
Let's say we have a blog application that executes several GraphQL operations related to comments (submitting a comment, fetching a post's comments, etc.). Our application likely has a `Comment` component that is responsible for rendering comment data.
@@ -1802,3 +1790,17 @@ The following masking utility types are available to override:
1802
1790
- `Unmasked<TData>` - Unwraps `TData` into the full result type
1803
1791
1804
1792
For more information about other overridable types in Apollo Client, see the [TypeScript guide](../development-testing/static-typing).
1793
+
1794
+
## Troubleshooting
1795
+
1796
+
### Unique names
1797
+
1798
+
Fragment names must be unique across your entire application. If you reuse a fragment name, the `graphql-tag` library warns about the conflict at runtime to help prevent bugs:
1799
+
1800
+
```text
1801
+
Warning: fragment with name SomeFragment already exists.
1802
+
graphql-tag enforces all fragment names across your application to be unique; read more about
1803
+
thisin the docs: http://dev.apollodata.com/core/fragments.html#unique-names
1804
+
```
1805
+
1806
+
As a best practice, use descriptive, component-scoped fragment names (like `ItemFragment` or `UserProfileFragment`) to avoid name collisions.
0 commit comments