-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Add support for Synced Patterns #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: da6501e 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
| renderedHtml, | ||
| }: CoreSyncedPatternProps ): ReactNode => { | ||
| const { style } = attributes || {}; | ||
| const styleObject = getStylesFromAttributes( { style } ); |
Copilot
AI
May 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'style' attribute is defined as a string in the type definitions but later processed via getStylesFromAttributes. Consider clarifying the expected format and ensuring consistency with usage examples and documentation.
| const styleObject = getStylesFromAttributes( { style } ); | |
| // Ensure the style attribute is a valid CSS string or object | |
| const validatedStyle = typeof style === 'string' ? style : ''; | |
| const styleObject = getStylesFromAttributes( { style: validatedStyle } ); |
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