Skip to content

fix: guard null content when regenerating document hash on updateGraphqlDocument#3879

Merged
jasonbahl merged 2 commits into
mainfrom
fix/smart-cache-document-null-content
Jun 4, 2026
Merged

fix: guard null content when regenerating document hash on updateGraphqlDocument#3879
jasonbahl merged 2 commits into
mainfrom
fix/smart-cache-document-null-content

Conversation

@jasonbahl

Copy link
Copy Markdown
Collaborator

What

Prevents a crash in Document::before_save when an updateGraphqlDocument mutation changes the alias/description without re-sending content.

Why

Extracted from #3784 so the bug fix lands as its own smart-cache patch, independent of the IDE major. The rebuilt IDE's Document Settings drawer edits alias/description without resending content, which surfaced this.

Fix

  • Fall back to the post's existing post_content (resolved from the input id) when content isn't a string.
  • Only append the normalized hash when there's actual string content to hash — no more hashing a null/missing value.

…hqlDocument

Extracted from #3784. On `updateGraphqlDocument`, callers may change the
alias/description without re-sending `content` (e.g. editing from a settings
panel). The previous code unconditionally hashed `$input['content']`, which
crashed on a null/missing value.

Now it falls back to the post's existing `post_content` (looked up from the
input id) when `content` isn't a string, and only appends the normalized hash
when there's actual string content to hash.
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wpgraphql-com Ready Ready Preview, Comment Jun 4, 2026 12:27am

@jasonbahl jasonbahl merged commit 95c732b into main Jun 4, 2026
43 checks passed
@jasonbahl jasonbahl deleted the fix/smart-cache-document-null-content branch June 4, 2026 00:43
jasonbahl added a commit that referenced this pull request Jun 4, 2026
Sync main (split PRs #3877/#3878/#3879 + asset-pipeline #3880/#3882/#3883) into
the IDE rebuild branch. Conflicts were all IDE release-metadata + the plugin
header; resolved as:

- package.json / wpgraphql-ide.php Version / readme.txt Stable tag: 4.5.0
  (the release-please manifest value; release-please bumps to 5.0.0 at release —
  the in-repo version tracks the last release per the plugin's CLAUDE.md).
- CHANGELOG.md / readme.txt changelog: union — keep the 5.0.0 notes AND main's
  released 4.5.0 entry.
- Requires at least: 6.1 (not the 7.0 the branch had staged). WordPress 7.0's
  i18n features (.l10n.php 6.5, JIT textdomain 6.7) degrade gracefully and no
  runtime gate gates on 7.0, so there's no reason to lock out current installs.
  Dropped the "raised floor to 7.0" breaking-change note and aligned CLAUDE.md +
  i18n docs to 6.1.
- Tested up to: 7.0 (WordPress 7.0 is released).
jasonbahl added a commit to josephfusco/wp-graphql that referenced this pull request Jun 4, 2026
Sync main (split PRs wp-graphql#3877/wp-graphql#3878/wp-graphql#3879 + asset pipeline wp-graphql#3880/wp-graphql#3882/wp-graphql#3883) onto
the IDE rebuild branch, on top of Joe's floor/CI commits (floor 6.1, WP 7.0 CI
coverage + tested-up-to). Conflicts (all IDE release metadata) resolved as:

- Version / Stable tag / package.json: 4.5.0 (release-please manifest value;
  release-please bumps to 5.0.0 at release — in-repo version tracks last release
  per the plugin's CLAUDE.md).
- CHANGELOG.md / readme.txt changelog: union — keep the 5.0.0 notes AND main's
  released 4.5.0 entry. Dropped the now-inaccurate "raised floor to 7.0"
  breaking-change note (Joe set the floor to 6.1) and the 7.0-floor framing in
  the i18n docs.
- Requires at least: 6.1 / Tested up to: 7.0 — kept Joe's values.
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.

1 participant