-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-source-wordpress] ACF Flexible content in Flexible content returns duplicates #8910
Comments
@jordyvg Can you create reproduction repo? If this happens there is probably bug somewhere here gatsby/packages/gatsby-source-wordpress/src/normalize.js Lines 510 to 552 in 2d2e29b
id is getting reused for all nested children (which will overwrite them)
|
@pieh Thank you, the reused
It is probably not the best way to do it, but an unique
The code above returns:
GraphiQL response:
|
Yeah, if possible we should avoid using _.each(obj, (value, key) => {
if (_.isArray(value) && value[0] && value[0].acf_fc_layout) {
obj[`${key}___NODE`] = value.map(
- v =>
+ (v, itemIndex) =>
prepareACFChildNodes(
v,
- entityId,
+ `${entityId}_${itemIndex}`,
topLevelIndex,
type + key,
children,
childrenNodes
).id
)
delete obj[key]
}
}) |
Works, seems fine to me. |
@jordyvg would you be interested in opening PR with that change? |
) * Fix: added unique id for ACF childeNodes (gatsbyjs#8910) * Fix: added unique id for ACF childeNodes (gatsbyjs#8910)
Description
Flexible content in Flexible Content returns an array with only the first unique row times the amount of rows. So all the rows after row 1 are duplicates of row 1 (even if every row are different field types).
Only one level Flexible Content works just fine.
Steps to reproduce
Add another ACF Flexible Content field inside the parent Flexible Content field.
Expected result
All rows to be unique.
Actual result
Rows are duplicates of the first row.
The WordPress Rest API:
GraphiQL query:
GraphiQL response:
Environment
The text was updated successfully, but these errors were encountered: