tinacms / tina-graphql-gateway

Makes it easier to build TinaCMS websites with a GraphQL Layer.
https://tina.io/cloud
Apache License 2.0
6 stars 2 forks source link

Unable to query template with Select type #271

Closed ACoolTurtle closed 3 years ago

ACoolTurtle commented 3 years ago

Description

Graph API unable to interpret Select component, gives the following error when queried:

String cannot represent value: { label: "foo", value: "foo" }
String cannot represent value: { label: "bar", value: "bar" }

Steps to reproduce

Create a schema including options

defineSchema({
    collections: [
        {
            label: "A Cool Collection",
            name: "collection",
            path: "foo/bar",
            templates: [
                {
                    label: "Template",
                    name: "template",
                    fields: [
                        {
                            type: "select",
                            label: "Select Element",
                            name: "select",
                            options: ["foo", "bar"],
                        },
                    ],
                },
            ],
        },
     ]
 });

Expected result

The query to not error.

Actual result

String cannot represent value: { label: "foo", value: "foo" }
String cannot represent value: { label: "bar", value: "bar" }

Environment

Tinacms Package Versions

react-tinacms-editor@npm:0.41.1
react-tinacms-inline@npm:0.41.1
tinacms@npm:0.41.1

Tools

Tool Version
browser Chrome 91.0.4472.106
os Windows 10, WSL 2 Ubuntu
node 15.7.0
npm 7.4.3
ACoolTurtle commented 3 years ago

Upon further review, this error is directly related to the options child of the form request to the Tina API. This error does not appear locally, which makes me think that the API version may be outdated at the moment.

jeffsee55 commented 3 years ago

Thanks @ACoolTurtle , I think you're right - we need to bump the version on the cloud server

ACoolTurtle commented 3 years ago

Ok, sounds good! Has there been any progress on this?

DirtyF commented 3 years ago

@ACoolTurtle Our team is working on this. We'll update the issue when we have progress to share, stay tuned!

jamespohalloran commented 3 years ago

That's now been updated to the latest version in Tina Cloud server!

ACoolTurtle commented 3 years ago

This bug seems to have worked its way back into this package. I have not found the commit where it was re-added yet, however when running local on the latest version, and querying a Select field, you once again receive the error String cannot represent value:. When requesting from the Tina server, the only response now is Something went wrong.

logan-anderson commented 3 years ago

@ACoolTurtle Thanks for brining this to our attention. Here is a related issue: https://github.com/tinacms/tina-graphql-gateway/issues/296

logan-anderson commented 3 years ago

@ACoolTurtle this should be fixed by https://github.com/tinacms/tina-graphql-gateway/pull/304/files

ACoolTurtle commented 3 years ago

@logan-anderson this issue was fixed, however #296 still seems to be in effect from my side. However, this issue has been rectified. Thank you!

logan-anderson commented 3 years ago

@ACoolTurtle you are correct, thanks for pointing this out. There may have been an issue with the way we published the package.

logan-anderson commented 3 years ago

@ACoolTurtle #296 is fixed now. The fix can be applied by running yarn add tina-graphql-gateway-cli --dev