Skip to content

Conversation

@d-winter
Copy link
Contributor

Enhance README with comprehensive component chain documentation

Summary

This PR significantly expands the README documentation for the data-hygraph-component-chain attribute, providing developers with clear guidance on how to properly tag nested component fields for the Preview SDK.

Changes

  • Enhanced component chain documentation: Added detailed explanations of how component chains work and when to use them
  • Key concepts table: Introduced a clear reference table explaining the relationship between data-hygraph-entry-id, data-hygraph-field-api-id, and data-hygraph-component-chain
  • Clarified instanceId concept: Added GraphQL query examples showing how to extract instanceId values from Hygraph responses
  • Single-level component examples: Provided complete code examples for tagging fields within component lists
  • Deeply nested component examples: Added examples for multi-level component nesting (e.g., Page.contentSections[].features[])
  • Union/modular component examples: Included examples for handling multiple component types in union fields
  • Important clarifications: Emphasized that data-hygraph-entry-id should always be the root entry ID, not the component instance ID

Why This Matters

The component chain attribute is one of the more complex features of the Preview SDK, and the previous documentation was minimal. This enhancement provides developers with:

  • Clear understanding of when and why to use component chains
  • Practical, copy-paste-ready examples for common scenarios
  • Visual examples showing the resulting HTML attributes
  • Helper function usage (createComponentChainLink, createPreviewAttributes)

Testing

  • Documentation reviewed for accuracy
  • Examples verified against actual SDK behavior
  • Code examples formatted correctly

Related

Addresses developer feedback about unclear component chain documentation.

…chain` and related attributes, including examples for single-level and deeply nested components.
@d-winter d-winter requested a review from a team as a code owner November 24, 2025 11:53
@d-winter d-winter merged commit 673fa2b into main Nov 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants