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

feat!: Narrow FormField.choices and .inputs types to their implemations #415

Merged

Conversation

justlevine
Copy link
Member

What

This PR updates the schema types for the FormField.choices and FormField.inputs fields to their respective implementing type, instead of the interface.

Why

... on OptionField {
  adminLabel
  canPrepopulate
  choices {
  ... on OptionFieldChoice { # 👈 This is unnecessary and redundant. We **know** this b/c its on the OptionField
    formattedPrice
    isSelected
    price
    text
    value
  }
  
  # ✔️ Now we can query it directly on the `choice`
  formattedPrice
  isSelected
  price
  text
  value
}

How

Uses the new Utils::overload_graphql_field_type to avoid the validation issues in graphql_register_field()

Testing Instructions

Additional Info

Checklist:

  • This PR is tested to the best of my abilities.
  • This PR follows the WordPress Coding Standards.
  • This PR has proper inline documentation.
  • This PR has unit tests to verify the code works as intended.
  • The changes in this PR have been noted in CHANGELOG.md

@justlevine justlevine added the safe to test ✔ This PR can be run using repository secrets label May 13, 2024
@justlevine justlevine merged commit 2be7e1e into AxeWP:develop May 13, 2024
17 of 35 checks passed
@justlevine justlevine deleted the feat/narrow-choice-input-interface-types branch May 13, 2024 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test ✔ This PR can be run using repository secrets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant