Closed fchengpc closed 3 years ago
Hey,
can you add some example code with ideally a request and an endpoint if it is public? I am not familiar with using GraphQL with Prismic
My bad, i lost track of this issue.
here is some sample link fragment:
{"_linkType":"Link.document","_meta":{"id":"XZvpkxIAACMAu8Vw","uid":"test--scheduler","__typename":"Meta"},"__typename":"Scheduler"}
import { Link } from 'prismic-reactjs';
export function RichLink(link) {
return Link.url(link, linkResolver);
}
above code do not go into linkResolver
https://github.com/prismicio/prismic-reactjs/issues/37 might be the same issue
Ha, good catch. This one is actually an issue happening on several packages - we should check for both "Document" and "Link.Document"and same for "Link" I believe.
Do you want to take care of this one?
This PR should solve the issue: https://github.com/prismicio/prismic-helpers/pull/3
Sounds like the fix for this is already in motion, but I am seeing the following different shapes for links in two different projects. Both use the REST API V2, but I think one of them might have GraphQL enabled on the repo (but unused).
Is this intentional? Sorry, I realize this is more of an API question than prismic-reactjs
.
Project 1:
Maybe with GraphQL enabled on the repo, but unused. Note the type: "Link.document"
{
"type": "Link.document",
"value": {
"document": {
"id": "XFyp-BAAACIAIod-",
"type": "page",
"lang": "en-us",
"tags": [],
"slug": "about",
"uid": "people"
}
},
"isBroken": false
}
Project 2:
Without GraphQL enabled on the repo. Note the link_type: "Document"
{
"id": "XZKZGxIAACQAZah3",
"type": "page",
"tags": [],
"slug": "about",
"lang": "en-us",
"uid": "about",
"link_type": "Document",
"isBroken": false
}
the prismic gql return object as following
{"_linkType":"Link.web","__typename":"_ExternalLink"}
then when you try to uselink
to render the url it throw