Trying to use the new StructuredText React component to render out an inline video in a Case Studyās content field (page template). Everything works fine for the rest of the content, like headings/paragraph elements but canāt seem to get the video rendered correctly. Seems like under the hood the StructuredText component is trying to match the records with their ID but is getting an error due to how the response is structured. The data being returned is formatted like āDatoComponentNameHere-5611846ā instead of just simply returning the id alone. Any thoughts on where I might be going wrong here? Had the idea of either mutating the response, or digging into the GraphQL query Iām using more but thought Iād reach out to see if anyone had similar experience - any direction at all would be highly appreciated! Please and thanks in advance~ cheers
Note: Hereās a link to the response Iām getting ā also happy to provide any other information that might be helpful in debugging this
Sample code can be found here for the query & the response here. And in the codebase, weāre doing something that looks like the screenshot I attached (hereās where we render out the components.) Let me know if this suffices
That doesnāt quite look like the standard response⦠are you perhaps using a special client or middleware?
Exactly! The middleware being Gatsby in this specific scenario. Strangely enough, the response looks just fine from the DatoCMS API explorer but seems to be mutating when queried through GraphQL. Iām assuming this has to do with how Gatsby is handling the response, but Iād love to hear the insight you could offer on whatās the best practice here: do we mutate the response once its received or?.. To me, this just seems counterintuitive but works in the meantime
Sorry, Iām not familiar with Gatsby and how it works
Your GraphQL and React code look fine, though that doesnāt help you right now. A DatoCMS rep should be along shortly to help, hopefully! (In case it wasnāt clear, I donāt work for them ā was just trying to help in case of a coding error or whatnot, which it doesnāt seem to be)
when you use gatsby with our āgatsby-source-datocmsā, you are not actually doing any graphql request to our graphql endpoint (https://graphql.datocms.com), because gatsby embeds its own graphql server that fetches data from various āsourcesā.
āgatsby-source-datocmsā plugin downloads all of your project records using our REST api under the hood.
So, yes itās perfectly normal that the same query returns a different result when run inside the API Explorer and in the gatsby graphql explorer.
I think you are doing it in the right way, @kestrada .
@dthreatt I think I can help! When you do your query in Gatsby, make sure that you are querying originalId with the alias id instead the normal id. Basically, gatsby-source-datocms is creating its own unique ids for imported data in order to avoid potential (however unlikely) overlap.