docs: document inline (colocated) named fragments#80
Open
rellampec wants to merge 2 commits into
Open
Conversation
Introduce a CHANGELOG (reconstructed from merged PRs and release tags back to 0.23.0, with an Unreleased section) and a CONTRIBUTING guide documenting the fork -> topic-branch -> test (Minitest) -> CHANGELOG -> PR flow. Upstream master previously had neither file.
Document that standard named GraphQL fragments defined inline in the same parse string as the operation are supported, with fields directly accessible on the result (no enforced component isolation). Mirrors Apollo Client's colocating-fragments convention. Addresses github-community-projects#76. - README: 'Named fragments defined inline' section + Apollo reference - guides/implicitly-fetched-field-error.md: 'When isolation does not apply' - CHANGELOG: Unreleased entry referencing github-community-projects#76
This was referenced Jun 15, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Documents that standard named GraphQL fragments defined inline — a
fragment Name on Type { … }definition placed in the sameparsestring as the operation that spreads it — are supported, and their fields are directly accessible on the result (noImplicitlyFetchedFieldError, no re-wrapping through a fragment constant).This is documentation only — the behaviour already exists in
Client#parse(the local fragment definition is kept and the fields flow throughsource_document); it just wasn't documented anywhere.Files
README.md— new "Named fragments defined inline" section, with a note that this follows Apollo Client's colocating fragments convention.guides/implicitly-fetched-field-error.md— new "When isolation does not apply" section clarifying that inline fragments are not subject to the component-isolation error.CHANGELOG.md— one line under## Unreleased.Why
Resolves the confusion raised in #76: fragments can be used purely for reuse, Apollo-style, without forcing a parent–child component hierarchy. The constant-bound style remains for when you do want
ImplicitlyFetchedFieldErrorto guard cross-module access — the two are complementary, and the docs spell out the distinction.Addresses #76. (Deliberately not "Closes" — see below.)
Scope / notes for reviewers
lib/changes. Behaviour is unchanged; this only documents it.to review alongside, as they demonstrate the documented guarantees.
/fragment\s*#{const_name}/heuristic in
Client#parse, which can misfire on prefix collisions (e.g....UserFieldsvsfragment UserFieldsExtended). A follow-up will anchor that match; Would it be possible to use Fragments just for pure re-usability? (without forced parent-child component encapsulation) #76 stays open as the tracking issue until then.CHANGELOG.md). Until that merges, this PR's diff also shows the CHANGELOG/CONTRIBUTING commit; it'll narrow to just the docs once docs: add CHANGELOG and CONTRIBUTING #79 lands.