Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues preventing the queries tab from working #149

Merged
merged 2 commits into from
Oct 31, 2018

Conversation

hwillson
Copy link
Member

Currently, the code to extract a query name to show in the queries panel, expects the incoming query to always have the document.loc.source attribute available. If this attribute isn't available, an exception is thrown, and the queries panel is displayed as a blank page. These changes adjust the logic used to extract a query label to be more flexible. The query name is now derived by attempting the following (in order):

  1. Attempt to parse and extract a query name from an incoming query string.
  2. Check to see if the incoming query has already been parsed; if so extract the query name from the parsed document (e.g. happens when using graphql-tag).
  3. If the incoming query has already been parsed, but the query name can't be extracted from the result, see if the document includes the original query source. If so, try re-parsing it, and re-extracting the query name.
  4. If all else fails, fallback on using the query ID as the query name.

Fixes #137.

Currently, the code to extract a query name to show in the
queries panel, expects the incoming query to always have
the `document.loc.source` attribute available. If this
attribute isn't available, an exception is thrown, and the
queries panel is displayed as a blank page. These changes
adjust the logic used to extract a query label to be more
flexible. The query name is now derivd by attempting
the following (in order):

1. Attempt to parse and extract a query name from
an incoming query string.
2. Check to see if the incoming query has already
been parsed; if so extract the query name from the
parsed document (e.g. happens when using `graphql-tag`).
3. If the incoming query has already been parsed, but
the query name can't be extracted from the result, see
if the document includes the original query source. If
so, try re-parsing it, and re-extracting the query name.
4. If all else fails, fallback on using the query
ID as the query name.

Fixes #137.
@hwillson hwillson merged commit cb51c11 into master Oct 31, 2018
@alessbell alessbell deleted the hwillson/issue-137 branch September 14, 2023 15:03
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.

1 participant