FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor: graphiql template shared across servers by KingDarBoja · Pull Request #49 · graphql-python/graphql-server · GitHub

refactor: graphiql template shared across servers - #49

Merged
KingDarBoja merged 7 commits into
graphql-python:masterfrom
KingDarBoja:refactor-graphiql-template
Jul 11, 2020
Merged

refactor: graphiql template shared across servers#49
KingDarBoja merged 7 commits into
graphql-python:masterfrom
KingDarBoja:refactor-graphiql-template

Conversation

KingDarBoja commented Jul 6, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

Fixes #48.

EDIT
I forgot to add the typing-extensions on the setup file in order to support the TypedDict 🤦‍♂️

KingDarBoja added the type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change label Jul 6, 2020
KingDarBoja requested review from Cito and jkimbo July 6, 2020 00:45
KingDarBoja self-assigned this Jul 6, 2020
variables: {{variables|tojson}},
operationName: {{operation_name|tojson}},
defaultQuery: {{default_query|tojson}},
headerEditorEnabled: {{header_editor_enabled|tojson}},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

might be worth adding shouldPersistHeaders as well, to decide whether or not the headers tab should persist it's values in localstorage by default

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you point out where it is defined? So far I am looking at the current renderGraphiQL.js implementation at the express-graphql package and I didn't saw shouldPersistHeaders.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

"graphiql_version": graphiql_version,
"graphiql_html_title": graphiql_html_title,
"query": data.get("query"),
"variables": data.get("variables"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

we also have a new headers string prop that allows you to set the default headers value if you want :)

KingDarBoja Jul 6, 2020
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I just noticed latest changes on renderGraphiQL.js have the headers option but it is passed at the graphQLFetcher function whereas these variables are passed to the ReactDom function.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

you can see the new props here: https://github.com/graphql/graphiql/tree/1.0.0/packages/graphiql#props

the headers that are passed in the fetcher function are the ones from the editor. the headers react prop is for pre-populating the headers editor

Comment on lines +36 to +43
<link href="//cdn.jsdelivr.net/npm/graphiql@{{graphiql_version}}/graphiql.css" rel="stylesheet" />
<script src="//cdn.jsdelivr.net/npm/promise-polyfill@8.1.3/dist/polyfill.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/unfetch@4.1.0/dist/unfetch.umd.js"></script>
<script src="//cdn.jsdelivr.net/npm/react@16.13.1/umd/react.production.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/react-dom@16.13.1/umd/react-dom.production.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/graphiql@{{graphiql_version}}/graphiql.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/subscriptions-transport-ws@0.9.16/browser/client.js"></script>
<script src="//cdn.jsdelivr.net/npm/graphiql-subscriptions-fetcher@0.0.2/browser/client.js"></script>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Based on 1.0.0 readme, looks like the promise-polyfill cdn isn't needed, right? @acao

Also I noticed that the subscription-transport-ws package has been archived so I am not sure if there are alternatives up to date for supporting subscriptions. Do you have any idea about it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

promise-polyfill has everything to do with whether you want IE support

subscription-transport-ws is still an active project and should be used. we removed it from our example and never got around to providing a new subscriptions example

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oops, I linked the wrong package, I meant graphiql-subscriptions-fetcher which still shows up on the use it with graphiql readme section of subscription-transport-ws.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Also, by looking at the subscription-transport-ws, I am a bit worried about the latest release as it was at March 2019 and there are several PRs and issues waiting for maintainers to be answered so not sure if it is active at another branch or fork but would be good to know.

jkimbo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Couple of small comments but otherwise this looks great!

Comment thread graphql_server/aiohttp/graphqlview.py Outdated
Comment thread graphql_server/aiohttp/graphqlview.py Outdated

jkimbo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍 looks good @KingDarBoja

KingDarBoja merged commit accfef4 into graphql-python:master Jul 11, 2020
KingDarBoja deleted the refactor-graphiql-template branch July 11, 2020 14:12
KingDarBoja added this to the GraphQL-Server (V3) milestone Jul 12, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor graphiql template and update to latest version

3 participants


Back | FazBrowse Home | New Git URL