Skip to content

Conversation

@justlevine
Copy link
Collaborator

What does this implement/fix? Explain your changes.

This PR adds the public get_unfiltered_args() method to AbstractConnectionResolver for fetching the GraphQL $args before they have been modified by any filters/side effects.

Additionally child classes that were using an unmodified local copy of $args have been updated to use ::get_unfiltered_args() instead.

Does this close any currently open issues?

Part of #2749

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

Any other comments?

  • This PR is based on chore: prepare ConnectionResolver classes for v2 backport #3082 , which should be merged first.
  • Despite the new AbstractConnectionResolver::$unfiltered_args property/getter, we are still setting $this->args in the constructor multiple times (for backwards compatibility). This will be addressed in a future PR.
  • Similarly, the new public getter obviates the need for the $unfiltered_args parameter on several filters, and those will be deprecated in a future PR as well.

Where has this been tested?

Operating System: Ubuntu 20.04 (wsl2 + devilbox + php 8.1.15)

WordPress Version: 6.4.3

@justlevine justlevine added type: enhancement Improvements to existing functionality status: in review Awaiting review before merging or closing needs: reviewer response This needs the attention of a codeowner or maintainer component: connections Relating to GraphQL Connections scope: api Issues related to access functions, actions, and filters labels Mar 30, 2024
@justlevine justlevine requested a review from jasonbahl March 30, 2024 14:24
@justlevine justlevine changed the title dev: add AbstractConnectionResolver::get_unfiltered_args() public getter refactor: add AbstractConnectionResolver::get_unfiltered_args() public getter Mar 30, 2024
@jasonbahl jasonbahl merged commit 28776fe into chore/connection-resolvers-cleanup Apr 22, 2024
This was referenced Apr 22, 2024
@justlevine justlevine deleted the dev/cr2-backport/get_unfiltered_args branch April 23, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: connections Relating to GraphQL 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 Awaiting review before merging or closing type: enhancement Improvements to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants