Closed LiamWinterton closed 1 year ago
Narrowed this down to having multiple images on my post.
I have a featuredImage on my post, as well as my sharedImage in my SEO component, also attached to post. Removing one exposes the other.
Is this a bug?
Hi Liam,
Did you deep populate the images in your gatsby-config.js?
Like so, in the gatsby-source-strapi plugin in gatsby-config.js:
... populate: { sharedImage: "*", Testimonial: { populate: "*", }, ...
Save and restart Gatsby. Hope it helps.
Cheers, Jacco
Hi Liam,
Did you deep populate the images in your gatsby-config.js?
Like so, in the gatsby-source-strapi plugin in gatsby-config.js:
... populate: { sharedImage: "*", Testimonial: { populate: "*", }, ...
Save and restart Gatsby. Hope it helps.Cheers, Jacco
Using both:
queryParams: {
populate: {
seo: {
socialImage: "*"
}
}
}
queryParams: {
populate: {
seo: {
socialImage: {
populate: "*"
}
}
}
}
and:
Removes all the socialimage field from my graphql entirely. (I changed the name from shareImage to socialImage in hopes of kicking it up the arse a bit.
@bureauberg This seems to only be an issue with the fact that my image is a sub component. If I remove the component and add an image field directly to the seo component it works perfectly fine.
Have you tried:
queryParams: {
populate: {
seo: {
populate: {
socialImage: "*"
}
}
}
}
Have you tried:
queryParams: { populate: { seo: { populate: { socialImage: "*" } } } }
Yes, tried that. As well as trying to explicitly populate the individual fields.
Only way I can get an image in my SEO component is to add it as a field directly. Any component with an image I can't retrieve.
It is possible. I have components in components in DZ's. Its just mind boggling to write the populate queries...
You can try to "debug" it by calling the REST API yourself with the populate fields. You can see what endpoint is being called by Gatsby when you run develop. Copy/Paste that URL and try to change it to work.
Maybe it's this:
queryParams: {
populate: {
// probably you need to put `image: *` here as well if you have an image directly on the post. The default `populate: *` gets removed by using this feature
seo: {
populate: 'socialImage'
}
}
}
Maybe it's this:
queryParams: { populate: { // probably you need to put `image: *` here as well if you have an image directly on the post. The default `populate: *` gets removed by using this feature seo: { populate: 'socialImage' } } }
populate: "socialImage" appears to be the solution.
Do you mind sharing how you came to this conclusion, because I couldn't find anything about this in the docs?
Thats a very good question... I guess I just fiddled around long enough with all the options laid out in: https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#relation-media-fields and https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#component-dynamic-zones
it's a hot mess to get the correct combination going.
Unfortunately we've since moved to sanity!
On Fri, 16 Dec 2022, 18:03 Charanjit Singh, @.***> wrote:
Huff finally: https://market.strapi.io/plugins/strapi-plugin-populate-deep
— Reply to this email directly, view it on GitHub https://github.com/strapi/gatsby-source-strapi/issues/354#issuecomment-1355329293, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH2X4DNAHFL76RTD3BDKHZDWNSVF5ANCNFSM6AAAAAARZLPBXE . You are receiving this because you authored the thread.Message ID: @.***>
Thanks for your interest in this project. This plugin is moving into the Gatsby User Collective and this repo will be archived. Please open an issue in that repository, submit a PR if you'd like to see this implemented, or join us on Discord if you have questions!
I have a basic component called SEO, that I have added to a collection called post(s).
Inside this SEO component I also have another component called image, which contains an image field and a text field for specifying alt text. I added this under the key sharedImage
In the admin, I can create a post just fine, and populate all this data. In the gatsby graphql playground, I can obtain my posts, my direct SEO data fields ( metaTitle, metaDescription ) but sharedImage is no-where to be found.
I've cleared gatsby cache with gatsby clean and restarted both strapi and gatsby 10's of times now, and this data is simply not populating. Is there a known issue / limitation with this?