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

dev: refactor ContentBlocksResolver and deprecate TraverseHelpers #279

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

justlevine
Copy link
Contributor

@justlevine justlevine commented Sep 12, 2024

What

This PR refactors ContentBlocksResolver for code complexity/maintainability (SOLID) and to better resembles WordPress's internal block parsing/rendering.

More specifically, ::resolve_content_blocks() no longer retains any top-level logic, and instead blocks are parsed recursively (::parse_blocks() -> ::handle_do_blocks()->::handle_do_block()` )

As a result, TraverseHelpers has been deprecated entirely.

Why

This lays the groundwork for fixing missing values due to incorrect hydration, moving field resolution from resolvers to a model, fixing layout css classes, and a few performance improvement strategies I'm investigating.

Note

There is no pressing need to merge this until either more tests are backfilled or future PRs that actually address code issues are pushed for review.
Followed up by #284

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

changeset-bot bot commented Sep 12, 2024

🦋 Changeset detected

Latest commit: 31944d8

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

@justlevine justlevine force-pushed the dev/refactor-ContentBlocksResolver branch from f0860a6 to 31944d8 Compare September 16, 2024 21:04
@theodesp theodesp merged commit 766737d into wpengine:main Sep 19, 2024
10 of 11 checks passed
@justlevine justlevine deleted the dev/refactor-ContentBlocksResolver branch September 19, 2024 10:19
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