Open jabby09 opened 7 months ago
@Atmosfearful / @0xemc / @jabby09 looking at this issue this morning. The tooltips use the caption
field from the api, this looks to be returning null, and this is the reason the tooltips aren't displaying anything when hovering. See image below of response from api.
ooking at this issue this morning. The tooltips use the
caption
field from the api, this looks to be returning null, and this is the reason the tooltips aren't displaying anything when hovering. See image below of response from api.
@0xemc are you able to help @0xMakka and unblock this one?
I'm not sure why but there is a difference between the GraphQL schema and the old GROK schema (we used to use GROK but migrated 6 months ago)
GQL: https://l6of5nwi.api.sanity.io/v1/graphql/production/default
query getProjectContent($registry: String!, $registryProjectId: String!){
allProjectContent(where:{
project:{
registryProjectId:{eq:$registryProjectId},
registry:{eq:$registry}
}
}){
images {
asset {
url
altText
}
}
}
}
Sanity: https://carbon-projects.sanity.studio/vision
*[_type == 'project' && registry == $registry && registryProjectId == $registryProjectId][0]{
"id": id.current,
"projectContent": *[references(^._id)]{
images[]{
caption,
'url': asset->url
}
}[0],
}
I've raised this in the Sanity Slack workspace and am waiting on a response.
I've raised this in the Sanity Slack workspace and am waiting on a response.
@0xemc any update on this?
@jabby09 I got a response from another developer (posting here for posterity):
I believe the reason for the SanityImageAsset type not containing the caption attribute is because it is not something found on an image type by default. It is something every individual adds if they are looking to add more metadata fields to their images. Not sure how exactly your project is setup, but if you are able to set the type of your images to a custom type to include the asset attribute and then also your custom attribute of caption. This is how I have done it in my Next.js projects. import { ImageAsset } from 'sanity';
type TImage = { asset: ImageAsset; alt?: string; // In your case it would be caption };
Hope this somewhat helps or at least points you in the right direction
Will investigate this further this week
See this project as example:
https://www.carbonmark.com/projects/VCS-1190-2017
I cannot click on the info icon to show the caption.
Using Chrome on mac.