craft-linkfield
craft-linkfield copied to clipboard
Inconsistencies whereby some instances of the field do not allow subsets and returns a string only | GraphQL + linkfield 2.0.0-rc.1
I have a strange issue, that despite clearing cache, re-installing and re-creating fields, some instances of the linkfield do not allow any subsets whereas others do. For example:
This works (supertable field inside a matrix)
cta {
... on cta_BlockType {
linkTo {
url
element {
slug
uri
id
title
}
text
}
weight
}
}
}
returns successfully:
"cta": [
{
"linkTo": {
"url": "https://cms.protopixel.io/showcase",
"element": {
"slug": "showcase",
"uri": "showcase",
"id": "1024",
"title": "Showcase"
},
"text": "Find out how"
},
"weight": "tertiary"
}
]
This doesn't work (supertable field inside a global)
... on footer_GlobalSet {
utilityNav {
... on utilityNav_group_BlockType {
label
links {
... on links_BlockType {
linkTo {
url
text
}
}
}
}
}
}
returns error:
{
"errors": [
{
"message": "Field \"linkTo\" of type \"String\" must not have a sub selection.",
"extensions": {
"category": "graphql"
},
"locations": [
{
"line": 10,
"column": 22
}
]
}
]
}
I have tried the following:
- Turning the field into a string field, saving, then clearing cache, then re-saving as a link field again
- deleting vendor and re-installing
- re-building yaml files
- re-generating all yaml updates
That's a really odd behavior and I don't have a quick explanation. How does the schema describe those fields?
I know right? its a wierd one that i've not experienced before.
For the footer global set the Schema describes 'linkTo' as a string. For the matrix field, it describes it as a linkField_Link.
However, I can be sure that the field is a linkField as it has the linkField options in the CMS admin - see screenshot:
So why might this not be updating in GraphQL? other than clearing the data and graphql schema cache, or re-generating from yaml, is there something else i've missed?
Hey @sebastian-lenz Getting a lot of weird issues like this - such as this one - is it related? https://github.com/sebastian-lenz/craft-linkfield/issues/170
If you ironed out the v2 issues and then made this plugin a paid for install, I'd be happy to pay for it. I'm sure others would too as its the only viable link plugin with GraphQL support. Its needed on all our sites but the bugs are making things tricky :(
I highly doubt that these issues are related. And I won't make this plugin paid, there is a commercial alternative for those who need it (e.g. for the support), this was intended to be the open and free alternative.