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

fix: improve handling of empty blocks #317

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

justlevine
Copy link
Contributor

What

This PR improves the detection and handling of empty $blocks in ContentBlocksResolver.

More specifically:

  • ::is_block_empty() now checks for innerContent and innerHtml instead of re-calling render_block().
  • ::handle_do_blocks() now returns the array_values() of the filtered blocks, to prevent key mismatches once the empty blocks are removed.

Additionally the doc-types have been cleaned up, in particular iterable shapes.

Why

Backported fixes from rtCamp#31

Prompted by #315 , although I'm not able to replicate that specific error in v4.3.1

@justlevine justlevine requested a review from a team as a code owner November 29, 2024 05:36
Copy link

changeset-bot bot commented Nov 29, 2024

🦋 Changeset detected

Latest commit: c8832fc

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 Patch

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
Copy link
Member

theodesp commented Dec 2, 2024

Ta

@theodesp theodesp closed this Dec 2, 2024
@justlevine
Copy link
Contributor Author

@theodesp did you intentionally close this?

@josephfusco josephfusco reopened this Dec 4, 2024
@josephfusco josephfusco merged commit 1c975ec into wpengine:main Dec 4, 2024
10 of 11 checks passed
@theodesp
Copy link
Member

theodesp commented Dec 4, 2024

@theodesp did you intentionally close this?

Sorry probably a mistake. I merged it now thanks

@justlevine justlevine deleted the fix/block-resolver-empty-blocks branch December 4, 2024 18:11
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