-
-
Notifications
You must be signed in to change notification settings - Fork 29
chore: Add compatibility for WPGraphQL 2.3.3 and lazy-loaded descriptions. #457
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds backward compatibility for WPGraphQL versions prior to 2.3.0 by lazy-loading all description
and deprecationReason
properties, and updates the plugin metadata to reflect the new tested versions.
- Bumped plugin header to test up to WordPress 6.8.1 and WPGraphQL 2.3.3
- Introduced
Compat::resolve_graphql_config
to evaluate lazy-loaded configs on older WPGraphQL - Converted every GraphQL field/type description in
src/Type/...
to astatic fn() => __()
callable and wrapped object type registrations with the compatibility resolver
Reviewed Changes
Copilot reviewed 263 out of 264 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
wp-graphql-gravity-forms.php | Bump tested up-to versions for WP and WPGraphQL |
src/Utils/Compat.php | New helper for resolving lazy GraphQL configs |
src/Type/WPObject/AbstractObject.php | Wrapped object type registration with Compat::resolve_graphql_config |
src/Type/... | Converted all description /deprecationReason to lazy callables |
src/Type/WPObject/*Entry.php | Wrapped root query fields in compatibility resolver |
Comments suppressed due to low confidence (3)
src/Utils/Compat.php:29
- This comment is inverted: the code actually bails when the version is >= 2.3.0. Update the comment to say: "Bail if WPGraphQL version is 2.3.0 or greater, since those versions support lazy-loaded configs natively."
// Bail if WPGraphQL version is less than 2.3.0, since WPGraphQL can handle it.
src/Utils/Compat.php:28
- Consider adding unit tests for
resolve_graphql_config
, covering both branches (WPGraphQL >= 2.3.0 and < 2.3.0) and nested config resolution to ensure this helper works as intended.
public static function resolve_graphql_config( array $config ): array {
src/Type/WPInterface/NodeWithForm.php:41
- [nitpick] Interface type registrations currently skip the compatibility resolver. To keep behavior consistent, apply
Compat::resolve_graphql_config
when registering interface types in theirregister()
methods, similar to object types inAbstractObject
.
'formDatabaseId' => [
What
This PR adds support for WPGraphQL 2.3.x, including new support for lazy-loading descriptions.
A backwards-compatibility shim is used to support previous versions of WPGraphQL where a callable is not supported.
Why
How
Testing Instructions
Additional Info
Checklist: