Skip to content

Commit 359f3e6

Browse files
Add unique-names anchor to fragments docs (#13365)
Closes #13292 Adds a dedicated section for the unique-names anchor so graphql-tag warning links resolve properly. This is a docs-only change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added guidance on using unique GraphQL fragment names. * Included an example warning for fragment name collisions. * Recommended descriptive, component-scoped names to prevent conflicts. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Jerel Miller <jerelmiller@gmail.com>
1 parent db42896 commit 359f3e6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/source/data/fragments.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,3 +1790,17 @@ The following masking utility types are available to override:
17901790
- `Unmasked<TData>` - Unwraps `TData` into the full result type
17911791
17921792
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, `graphql-tag` provides a warning about the conflict at runtime to help you identify the issue:
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+
this in 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 `CartItemFragment` or `UserProfileCardFragment`) to avoid name collisions.

0 commit comments

Comments
 (0)