-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conditional images within Repeater field return null #240
Comments
This looks similar |
Results from testing with other ACF types below within the given constraints from above (field nested in repeater, nested in repeater):unexpected behavior:
expected behavior:
|
I have had a similar issue. Image fields inside a nested repeater with a return_format of 'url' will always show up as 'null' in the GraphQL response. I haven't been able to work out exactly what is going on, but it seems to be because all image GraphQL fields are registered as a MediaItem connection in the schema, but the entire repeater field array is passed into the resolver. In this case the value of the image field is a URL, which doesn't match the schema. I haven't tested it but I'd assume it's the same situation with files too. I also added some Page Links and they consistently show up as null. Again page links are strings but the schema defines them as connections as mentioned in #208. It seems that there's an issue with repeater fields where the schema of nested fields doesn't always match what's returned by ACF. In my case I was simply able to change the return_format of the image field to 'array' and that fixed it. |
@jamiemorganward very good! Thank you for your insight on getting around this. I'm curious how this will be handled moving forward. Do you think this classes as a bug or is technically working as intended? |
Description
I have existing data that I cannot retrieve from ACF via WPGraphQL. Specifically, the productImage field, nested within two repeaters, is returning null when images are saved.
Steps to reproduce
I'm not sure if the conditional element matters or the styled layout of the repeater fields, so here is everything from my experience that caused the issue:
example query:
example query variables:
PHP or JSON export of the ACF Field Group(s)
acf-export-2024-09-16.zip
Additional context
No response
WPGraphQL Version
1.28.1
WPGraphQL For ACF Version
2.4.1
ACF (Advanced Custom Fields) Version. Free or Pro?
Pro 6.3.6
WordPress Version
6.6.2
PHP Version
8.3.8
Additional enviornment details
additional plugins
coding environment
Front end framework: Nextjs
package.json
Please confirm that you have searched existing issues in the repo.
Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.
The text was updated successfully, but these errors were encountered: