I've been writing some queries to fetch the "linked documents" to use in my slice components. I've managed to write the correct query (I think) and tested it in the playground.
However, when I try to use the same query in my code. The link document object won't fetch that last bit of data in order to use in the PrismicLink component. Any help would be nice.
query allHomePages {
allHomes(id: "YvKx6xAAACAAyZS0") {
edges {
node {
slices {
__typename
... on HomeSlicesProject_card {
type
label
variation {
__typename
... on HomeSlicesProject_cardDefault {
primary {
title
description
link {
_linkType
... on _ExternalLink {
url
target
}
... on _Document {
_meta {
id
uid
}
}
}
image
}
}
}
}
__typename
... on HomeSlicesTech_stack_card {
type
label
variation {
__typename
... on HomeSlicesTech_stack_cardDefault {
items {
icon
tech_name
}
primary {
title
description
}
}
}
}
__typename
... on HomeSlicesCall_to_action {
type
label
variation {
__typename
... on HomeSlicesCall_to_actionDefault {
primary {
title
description
button_text
link {
_linkType
__typename
}
image
}
}
}
}
__typename
... on HomeSlicesHome_hero {
type
label
variation {
__typename
... on HomeSlicesHome_heroDefault {
primary {
title
button
link {
_linkType
__typename
}
image
}
}
}
}
}
_meta {
id
uid
type
tags
lang
}
_linkType
}
}
}
}
Hello @dirkkelderman, we ran a test query on our end. We noticed that there's a missing set to call the nested content inside the link field, you need to go one level further down like this:
I'm trying to get the links of the "HomeSlicesProject_card". The query I run there is with the nested link you suggested. So this is where the problem starts. I get that data in the explorer, not in the client.
I've tested it again and can't seem to see the error. If you want, you can send us the project code and the instructions to run it so we can see the err first hand.
Hi @dirkkelderman, I identified the problem. Link fields in Slice Machine are designed to link external web pages only. To create links to documents that need to use Content Relationship fields.
I will add a note to our documentation backlog to clarify this detail.
I tried that also, no luck. By the way, that still doesn't explains why the data in the chrome dev tool, and a console log, doesn't show the nested link documents. And the graphQL explorer does.