Skip to content
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

feat: expose EditorBlock.type field #285

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

justlevine
Copy link
Contributor

What

This PR adds the type field to the EditorBlock interface.

Why

Many block implementations (including Faust) rely on using the block type to match the component. Currently, the only way to do that is enable public introspection for the entire GraphQL server, and use __typename. By adding a type field, we can do that mapping without public introspection.

How

A new WPGraphQLHelpers::get_type_name_for_block() method has been introduced to keep the code DRY. It's been marked @internal to discourage usage (since once we have a Block model, we can just define the type and use $block->type to resolve the interface).

@justlevine justlevine requested a review from a team as a code owner September 17, 2024 12:31
Copy link

changeset-bot bot commented Sep 17, 2024

🦋 Changeset detected

Latest commit: ef90d29

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wpengine/wp-graphql-content-blocks Minor

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

@theodesp theodesp merged commit bced76d into wpengine:main Sep 18, 2024
10 of 11 checks passed
@justlevine justlevine deleted the feat/block-type-field branch September 18, 2024 14:49
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.

2 participants