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

refactor: split AbstractConnectionResolver::get_ids() into ::prepare_ids() #3123

Merged
merged 4 commits into from
May 8, 2024

Conversation

justlevine
Copy link
Collaborator

What does this implement/fix? Explain your changes.

The PR refactors AbstractConnectionResolver in the following ways:

  • ::get_ids() now instantiates AbstractConnectionResolver::$ids, only once.
  • The ID preparation logic has been moved into a new ::prepare_ids() method.

This improves the DX by reducing the amount of boilerplate needed when extending the AbstractConnectionResolver class, and improving lifecycle consistency, with potential performance benefits for child classes with complex ID preparation logic.

There are no breaking changes in this PR.

Important

This PR requires #3121 which should be merged first.

The relevant diff for this PR can be seen at f6babda

Does this close any currently open issues?

Part of #2749

Any relevant logs, error output, GraphiQL screenshots, etc?

Any other comments?

  • AbstractConnectionResolver::$ids is still manually instantiated and graphql_connection_ids manually applied in ::execite_and_get_ids() to maintain b/c compatibility with classes that are currently overloading ::get_ids() directly. Similarly, other methods that directly use AbstractConnectionResolver::$ids have not been changed to use ::get_ids().

Where has this been tested?

Operating System: Ubuntu 20.04 (wsl2 + devilbox + php8.1.15)

WordPress Version: 6.5.2

Copy link

codeclimate bot commented May 4, 2024

Code Climate has analyzed commit f6babda and detected 0 issues on this pull request.

View more on Code Climate.

@justlevine justlevine added Type: Enhancement New feature or request Status: In Review Needs to be reviewed by a project maintainer before merge Needs: Reviewer Response This needs the attention of a codeowner or maintainer. Component: Connections Issues related to connections scope: API Issues related to access functions, actions, and filters labels May 4, 2024
@justlevine justlevine requested a review from jasonbahl May 4, 2024 02:44
@coveralls
Copy link

Coverage Status

coverage: 84.35% (+0.02%) from 84.33%
when pulling f6babda on justlevine:dev/prepare_ids
into cb18964 on wp-graphql:develop.

jasonbahl
jasonbahl previously approved these changes May 8, 2024
@justlevine justlevine dismissed jasonbahl’s stale review May 8, 2024 17:17

The merge-base changed after approval.

@jasonbahl jasonbahl merged commit 565137f into wp-graphql:develop May 8, 2024
30 checks passed
@justlevine justlevine deleted the dev/prepare_ids branch May 8, 2024 17:37
@jasonbahl jasonbahl mentioned this pull request May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Connections Issues related to connections Needs: Reviewer Response This needs the attention of a codeowner or maintainer. scope: API Issues related to access functions, actions, and filters Status: In Review Needs to be reviewed by a project maintainer before merge Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants