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
fix: output list:$type
keys for Root fields that return a listOf Nodes
#2861
fix: output list:$type
keys for Root fields that return a listOf Nodes
#2861
Conversation
list:$type
keys for Root fields that return a listOf Nodes
return $type; | ||
} | ||
|
||
return null; |
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.
Avoid too many return
statements within this method.
|
||
$to_type = $field_def->config['toType'] ?? null; | ||
if ( empty( $to_type ) ) { | ||
return null; |
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.
Avoid too many return
statements within this method.
return null; | ||
} | ||
|
||
return $to_type; |
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.
Avoid too many return
statements within this method.
return null; | ||
} | ||
|
||
return $type; |
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.
Avoid too many return
statements within this method.
} | ||
|
||
if ( ! $is_list_type ) { | ||
return null; |
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.
Avoid too many return
statements within this method.
* | ||
* @return \GraphQL\Type\Definition\Type|String|null | ||
*/ | ||
public function get_wrapped_field_type( Type $type, FieldDefinition $field_def, $parent_type, bool $is_list_type = false ) { |
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.
Function get_wrapped_field_type
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Code Climate has analyzed commit 18da2f0 and detected 6 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
What does this implement/fix? Explain your changes.
This fixes a regression to the 1.14.5 release where
list:$type
keys are no longer being output for RootQuery fields that return a listOf Nodes.Does this close any currently open issues?
closes #2860
related: wp-graphql/wp-graphql-smart-cache#228
Any other comments?
Given the following snippet:
I could query for
testListOfPosts
:Before
We do not see
list:post
in the keysAfter
We DO see
list:post
in the keys