Skip to content

fix: drop textAlign from CoreHeading and CoreButton fragments - #383

Merged
josephfusco merged 1 commit into
mainfrom
fix/blocks-textalign-schema-drift
Jul 27, 2026
Merged

fix: drop textAlign from CoreHeading and CoreButton fragments#383
josephfusco merged 1 commit into
mainfrom
fix/blocks-textalign-schema-drift

Conversation

@josephfusco

@josephfusco josephfusco commented Jul 27, 2026

Copy link
Copy Markdown
Member

Every blog post 500s. Nonexistent slugs 500 as well instead of 404ing, while /blog/ is fine.

WordPress 6.8 moved textAlign on core/button from a block attribute to a block support, so WPGraphQL Content Blocks stopped exposing it. It is gone from CoreButtonAttributes and from CoreHeadingAttributes, which now uses align. Faust's stock heading and button fragments still request it, so GraphQL rejects the whole document at validation and getNextStaticProps throws before the notFound guard in getStaticProps can run. The blog index survives because its template queries editorBlocks without those fragments.

This overrides both fragments locally without textAlign. Nothing renders differently: alignment reaches the DOM through cssClassName, and neither the Faust component nor getStyles reads textAlign. CoreQuote still requests it and is left alone, since CoreQuoteAttributes still exposes it. Bumping @faustwp/blocks does not help, the current release ships the same fragments.

Upstream: wpengine/faustjs#2383. Same break as wpengine/faustjs#1932, where align was dropped from CoreQuoteAttributes.

Checked the composed query against the live schema. It fails validation on main, validates on this branch, and returns a null post for a nonexistent slug, which 404s correctly.

Worth a separate look: getStaticProps 500s on any GraphQL error rather than degrading, so the next schema change will take the blog down the same way.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): claude-opus-5
Used for: Root cause investigation, drafting, and implementation

Every blog post at /blog/<slug>/ returns a 500. The cause is GraphQL
schema drift, not a rendering error.

@faustwp/blocks ships CoreHeadingBlockFragment and CoreButtonBlockFragment
that request `attributes.textAlign`. That field no longer exists on
CoreHeadingAttributes (the schema now exposes `align`) or on
CoreButtonAttributes (removed outright) in the cms.faustjs.org schema:

  Cannot query field "textAlign" on type "CoreButtonAttributes".
  Cannot query field "textAlign" on type "CoreHeadingAttributes".

GraphQL rejects the entire document at validation time, so the query
returns no data at all and getNextStaticProps throws before the notFound
guard in getStaticProps can run. That is why a nonexistent slug also
returns 500 instead of 404, and why /blog/ itself is unaffected: the
index template queries editorBlocks without these fragments.

Override both fragments locally with the textAlign field removed.
Neither the Faust component nor getStyles reads textAlign; alignment
reaches the DOM through cssClassName, so rendering is unchanged.

CoreQuote also requests textAlign, but CoreQuoteAttributes still exposes
it, so that fragment is left alone.

Upgrading the package does not help: 6.1.9 ships the same fragments.
@headless-platform-by-wp-engine

Copy link
Copy Markdown

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-fix/blocks-textalign-schema-drift https://hc…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses blog post pages (/blog/<slug>/) returning 500s by removing GraphQL fragment selections (attributes.textAlign) that no longer exist in the CMS schema, preventing query validation failures that abort getStaticProps before the notFound path can run.

Changes:

  • Override the CoreHeading block fragment to drop attributes.textAlign and request attributes.align instead.
  • Add a local override for the CoreButton block fragment to drop attributes.textAlign.
  • Register the new CoreButton override in the local block registry so it replaces Faust’s stock block definition.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/wp-blocks/index.js Registers the local CoreButton override alongside existing overrides so it supersedes @faustwp/blocks defaults.
src/wp-blocks/core-heading.jsx Replaces Faust’s heading fragment with a local fragment that omits textAlign to match the CMS schema.
src/wp-blocks/core-button.jsx Introduces a local CoreButton override with a fragment that omits textAlign to avoid GraphQL validation failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@headless-platform-by-wp-engine

Copy link
Copy Markdown

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-fix/blocks-textalign-schema-drift https://hc…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Copy link
Copy Markdown

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-fix/blocks-textalign-schema-drift https://hc…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@josephfusco
josephfusco marked this pull request as ready for review July 27, 2026 16:40
@josephfusco
josephfusco requested review from a team and moonmeister as code owners July 27, 2026 16:40
@josephfusco
josephfusco enabled auto-merge July 27, 2026 16:40
@josephfusco
josephfusco merged commit 8200048 into main Jul 27, 2026
5 checks passed
@josephfusco
josephfusco deleted the fix/blocks-textalign-schema-drift branch July 27, 2026 17:45
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