Skip to content

fix: change default playground interface#319

Merged
zachdaniel merged 1 commit intoash-project:mainfrom
Gazler:fix/use-graphiql-playground
May 22, 2025
Merged

fix: change default playground interface#319
zachdaniel merged 1 commit intoash-project:mainfrom
Gazler:fix/use-graphiql-playground

Conversation

@Gazler
Copy link
Copy Markdown
Contributor

@Gazler Gazler commented May 22, 2025

Previously, the default playground interface was set to :playground which uses graphql-playground. However, this uses a deprecated JavaScript API which means that it does not work on modern versions of chrome. It also seems that the library is no longer maintained, so the chances of this being fixed in a future release are slim.

The result of this, is that tooltips do not disappear, making the application seem broken. Whilst this isn't a direct issue of this library, I think it gives a bad impression when things are broken out of the box.

This commit changes the generated interface to graphiql (using the :simple interface). There is also an :advanced interface option, but that also points to an unmaintained library which didn't work out of the box.

graphql/graphql-playground#1429

Sorry @sevenseacat this might mean the screenshots in the book need updating.

Previously, the default playground interface was set to `:playground`
which uses graphql-playground. However, this uses a deprecated
JavaScript API which means that it does not work on modern versions of
chrome. It also seems that the library is no longer maintained, so the
chances of this being fixed in a future release are slim.

The result of this, is that tooltips do not disappear, making the
application seem broken. Whilst this isn't a direct issue of this
library, I think it gives a bad impression when things are broken out of
the box.

This commit changes the generated interface to graphiql (using the
`:simple` interface). There is also an `:advanced` interface option, but
that also points to an unmaintained library which didn't work out of the
box.

graphql/graphql-playground#1429
@zachdaniel
Copy link
Copy Markdown
Contributor

We've had some issues with this for a while, and I think even graphiql is really out of date isn't it? Is there maybe some way we can vendor into ash_graphql a playground package that we can keep up to date ourselves? You've clearly done a bit of research here, any ideas?

@Gazler
Copy link
Copy Markdown
Contributor Author

Gazler commented May 22, 2025

I think even graphiql is really out of date isn't it?

https://github.com/graphql/graphiql

It seems to be reasonably active - the latest release was 2 days ago, however the absinthe_plug package is on a version from December 2024.

Is there maybe some way we can vendor into ash_graphql a playground package that we can keep up to date ourselves?

That's exactly how absinthe_plug does it. For example:

https://github.com/absinthe-graphql/absinthe_plug/blob/916d818e59c00d9aea45c41f0c108351d03119a8/lib/absinthe/plug/graphiql/graphiql.html.eex

@zachdaniel
Copy link
Copy Markdown
Contributor

Then perhaps we should just poke them to update graphiql 😂

With that said, it looks like there are also other issues w/ :simple? absinthe-graphql/absinthe_plug#303

@Gazler
Copy link
Copy Markdown
Contributor Author

Gazler commented May 22, 2025

I believe that the graphiql-workspace is used by :advanced (which is default) and hasn't been maintained for an even longer time!

https://github.com/OlegIlyenko/graphiql-workspace

@zachdaniel
Copy link
Copy Markdown
Contributor

🤔 AFAIK there are graphql playground tools that you can use and just point at an API, so maybe we should just encourage people to use those. Like this kind of thing: https://studio.apollographql.com/sandbox/explorer/?

So maybe we should generate the code, commented out, link to a description of why you can use these but you should prefer some online explorer? Not sure.

@Gazler
Copy link
Copy Markdown
Contributor Author

Gazler commented May 22, 2025

You can do something like that. It'll require CORS to be set up correctly to allow access though. I think you can embed apollo sandbox locally too, but that's no different to vendoring graphiql really.

@Gazler
Copy link
Copy Markdown
Contributor Author

Gazler commented May 22, 2025

Ok, so the flaw with :simple is that currently headers aren't being sent to the server.

absinthe-graphql/absinthe_plug#304
absinthe-graphql/absinthe-socket#67

But it seems like there is a fix 🤷

@zachdaniel
Copy link
Copy Markdown
Contributor

🚀 Thank you for your contribution! 🚀

@zachdaniel zachdaniel merged commit e1996c6 into ash-project:main May 22, 2025
17 of 18 checks passed
@sevenseacat
Copy link
Copy Markdown
Contributor

Thanks for the heads up, I'll check it out and make sure the screenshots are updated if necessary!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants