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

Conditional images within Repeater field return null #240

Open
2 of 3 tasks
miacias opened this issue Sep 16, 2024 · 3 comments
Open
2 of 3 tasks

Conditional images within Repeater field return null #240

miacias opened this issue Sep 16, 2024 · 3 comments
Labels
needs: reproduction This issue needs to be reproduced independently

Comments

@miacias
Copy link

miacias commented Sep 16, 2024

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:

  1. Create a field group called "Sale" that applies to a Post's category
  2. Add a repeater field to the field group called "Categories" with a layout of Block
  3. Add a checkbox field to the Categories field group called "Category Name" with a pre-filled choice list
  4. Add a repeater field called "Products" with a layout of Table inside the Categories repeater
  5. Add a true/false field inside the Products repeater called "Popular"
  6. Add an image field called "Product Image" that conditionally appears only when the "Popular" true/false field's value is true (checked) with a return format of Image URL
  7. Create a Post, select the given category, "Sale," that will populate the "Products" field group
  8. Make a set of 5 products with some popular and some not popular. For products that are popular, add an image
  9. Query the post by databaseId

example query:

query GetSalePostById($databaseId: ID!, $asPreview: Boolean = false) {
  post(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
    databaseId
    sale {
      popular
      productImage {
        node {
          sourceUrl
          mediaDetails {
            width
            height
          }
        }
      }
    }
  }
}

example query variables:

{
  "databaseId": "467"
}

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

  • Faustjs v1.4.1

coding environment

  • LocalWP v9.0.5+6706
  • MySQL v8.0.16

Front end framework: Nextjs

package.json

"dependencies": {
    "@apollo/client": "^3.11.8",
    "@faustwp/cli": "^3.1.0",
    "@faustwp/core": "^3.1.0",
    "@fortawesome/fontawesome-free": "^6.6.0",
    "@fortawesome/fontawesome-svg-core": "^6.6.0",
    "@fortawesome/free-brands-svg-icons": "^6.6.0",
    "@fortawesome/free-regular-svg-icons": "^6.6.0",
    "@fortawesome/free-solid-svg-icons": "^6.6.0",
    "@fortawesome/react-fontawesome": "^0.2.2",
    "@wordpress/base-styles": "^5.7.0",
    "@wordpress/block-library": "^9.7.0",
    "classnames": "^2.5.1",
    "graphql": "^16.9.0",
    "next": "^14.2.11",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "sass": "^1.78.0",
    "sharp": "^0.33.5"
  },
  "devDependencies": {
    "next-secure-headers": "^2.2.0"
  },
  "engines": {
    "node": ">=18",
    "npm": ">=8"
  }

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
@josephfusco josephfusco added the needs: reproduction This issue needs to be reproduced independently label Sep 18, 2024
@miacias
Copy link
Author

miacias commented Oct 15, 2024

This looks similar
#208

@miacias
Copy link
Author

miacias commented Nov 11, 2024

Here are some screenshots showing this issue in action where the images exist but return null:

Screenshot 2024-11-10 at 9 54 37 PM Screenshot 2024-11-10 at 9 54 46 PM

@miacias
Copy link
Author

miacias commented Nov 11, 2024

Results from testing with other ACF types below within the given constraints from above (field nested in repeater, nested in repeater):

unexpected behavior:

  • gallery returns empty array
  • file returns null
  • image returns null

expected behavior:

  • number returns number
  • text returns text
  • true/false returns true/false
  • wysiwyg editor returns html string
  • embed link returns embed link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: reproduction This issue needs to be reproduced independently
Projects
None yet
Development

No branches or pull requests

2 participants