feat: Add support for Synced Patterns#173
Conversation
🦋 Changeset detectedLatest commit: 0305644 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hey @omrjadhav - Thanks so much for taking the time to create this PR 🙇 Just one quick question:
Please confirm this solely about adding support for Synced Patterns, and doesn't affect |
|
Hi @justlevine 👋 Thank you for reviewing the PR! Yes, you're absolutely correct — this PR solely addresses the addition of support for Synced Patterns as outlined in Issue #96. The references to aria-label and CoreButton in the title/description were left over from an earlier draft and are not relevant to this PR. Apologies for the confusion! I'll update the PR title and description right away to reflect the accurate scope. Appreciate your attention to detail 😅🙏 |
Tooling is flaky and I don't trust it
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for overloading synced patterns in the WordPress block editor by implementing the new CoreSyncedPattern component and updating related definitions, tests, and documentation.
- Introduces a new CoreSyncedPattern type and component.
- Updates tests to validate proper handling of class names, style attributes, and graceful rendering with missing props.
- Updates documentation and block registration to include synced patterns.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/types/src/blocks/props/index.ts | Added export for synced pattern props. |
| packages/types/src/blocks/props/core-synced-pattern.ts | Introduced type definitions for CoreSyncedPattern. |
| packages/blocks/src/blocks/tests/core-synced-pattern.test.tsx | Added tests covering rendering, class names, and style processing. |
| packages/blocks/src/blocks/index.ts | Updated block definitions to include CoreSyncedPattern. |
| packages/blocks/src/blocks/core-synced-pattern.tsx | Implemented the CoreSyncedPattern component. |
| packages/blocks/README.md | Documented the new core-synced-pattern. |
| docs/overloading-wp-behavior.md | Updated documentation with guidelines for overloading synced patterns. |
| .changeset/silver-bikes-live.md | Created changeset for the PR. |
Add Support for Overloading Synced Patterns
What
This PR adds support for overloading synced patterns with custom React components. It implements the
CoreSyncedPatterncomponent and related infrastructure to properly handle synced patterns in the WordPress block editor.Why
Currently, WPGraphQL Content Blocks flattens Pattern blocks (wpengine/wp-graphql-content-blocks#345), which prevents developers from properly overloading synced patterns with custom React components. This PR fixes this issue by implementing proper support for synced patterns.
How
CoreSyncedPatterncomponent for rendering synced patternsTesting Instructions
Screenshots
Not applicable – changes are primarily in the component implementation and documentation.
Additional Info
This PR addresses the pattern flattening issue described in wpengine/wp-graphql-content-blocks#345 and implements the solution proposed in wpengine/wp-graphql-content-blocks#347.
Checklist
npm run changesetRelated Issue(s)
Fixes #96