Add unique-names anchor to fragments docs - #13365
Conversation
|
|
📝 WalkthroughWalkthroughAdds documentation explaining that GraphQL fragment names must be globally unique, showing the ChangesFragment naming documentation
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/source/data/fragments.mdx (1)
46-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the library name directly in the guidance.
Consider: “If you reuse a fragment name,
graphql-tagwarns about the conflict at runtime to help you identify and resolve bugs.” This is clearer and follows the documented product-voice guidance.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/source/data/fragments.mdx` at line 46, Update the fragment-name guidance to use the library name directly: state that graphql-tag warns about reused fragment names at runtime, while preserving the existing explanation that the warning helps identify and resolve bugs.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/source/data/fragments.mdx`:
- Line 54: Update the fragment naming examples in the documentation to use
unambiguously component-scoped names, replacing ItemFragment and
UserProfileFragment with examples such as CartItemFragment and
UserProfileCardFragment while preserving the guidance about avoiding name
collisions.
---
Nitpick comments:
In `@docs/source/data/fragments.mdx`:
- Line 46: Update the fragment-name guidance to use the library name directly:
state that graphql-tag warns about reused fragment names at runtime, while
preserving the existing explanation that the warning helps identify and resolve
bugs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: be85e29c-3a3b-4039-89eb-8a6028628db1
📒 Files selected for processing (1)
docs/source/data/fragments.mdx
| this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names | ||
| ``` | ||
|
|
||
| As a best practice, use descriptive, component-scoped fragment names (like `ItemFragment` or `UserProfileFragment`) to avoid name collisions. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Make the examples unambiguously component-scoped.
ItemFragment and UserProfileFragment describe entities but do not identify an owning component, so they can still collide. Prefer examples such as CartItemFragment or UserProfileCardFragment.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/source/data/fragments.mdx` at line 54, Update the fragment naming
examples in the documentation to use unambiguously component-scoped names,
replacing ItemFragment and UserProfileFragment with examples such as
CartItemFragment and UserProfileCardFragment while preserving the guidance about
avoiding name collisions.
There was a problem hiding this comment.
It looks like the MDX parser had trouble parsing the custom ID and using an <h2 /> tag broke deep links on the rest of the page. I went ahead and moved this to a troubleshooting section at the bottom so that its not so in-your-face. Thanks for putting this together!
commit: |
Closes #13292
Adds a dedicated section for the unique-names anchor so graphql-tag warning links resolve properly. This is a docs-only change.
Summary by CodeRabbit