Skip to content

Commit 18014a5

Browse files
authored
fix: correctly use filtered form fields when preparing the connection data. (#395)
* fix: correctly use filtered form fields when preparing the connection data. * tests: fix CaptchaFieldTest::testField
1 parent e0df04d commit 18014a5

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
## Unreleased
44

55
- fix: Ensure `EmailField` inputs are hydrated when Email Confirmation is disabled. H/t @gytjarek.
6+
- fix: Correctly use filtered form fields when preparing the connection data. H/t @samuelhadsall.
67
- chore: Update `yahnis-elsts/plugin-update-checker` to v5.3.
78
- chore: Update `axepress/wp-graphql-cs` to v2.0.0-beta.2 and fix resulting issues.
89
- chore: Update Composer dev deps.
9-
- chore: Test compatibility with WordPress 6.4.x
10+
- ci: Test compatibility with WordPress 6.4.x
1011
- docs: Add docs on troubleshooting i18n issues. H/t @dev-ditrict-web.
1112

1213
## v0.12.4

src/Data/Connection/FormFieldsConnectionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static function resolve( $source, array $args, AppContext $context, Resol
8686

8787
$fields = self::filter_form_fields_by_connection_args( $source, $args );
8888

89-
$fields = self::prepare_data( $source );
89+
$fields = self::prepare_data( $fields );
9090

9191
$connection = Relay::connectionFromArray( $fields, $args );
9292

@@ -172,7 +172,7 @@ private static function filter_form_fields_by_connection_args( $fields, $args ):
172172
if ( isset( $args['where']['pageNumber'] ) ) {
173173
$page = absint( $args['where']['pageNumber'] );
174174

175-
$fields = array_filter( $fields, static fn ( $field ) => $page === (int) $field['pageNumber'] );
175+
$fields = array_filter( $fields, static fn ( $field ) => $page === (int) $field->pageNumber );
176176
}
177177

178178
return $fields;

tests/wpunit/CaptchaFieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected function entry_query() : string {
116116
return "
117117
query getFieldValue(\$id: ID!, \$idType: EntryIdTypeEnum) {
118118
gfEntry(id: \$id, idType: \$idType ) {
119-
formFields(where:{fieldTypes:CAPTCHA}) {
119+
formFields {
120120
nodes {
121121
{$this->field_query}
122122
}

0 commit comments

Comments
 (0)