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

Don't open and focus on new tab when sharing playground #893

Closed
daxro opened this issue Nov 26, 2018 · 5 comments
Closed

Don't open and focus on new tab when sharing playground #893

daxro opened this issue Nov 26, 2018 · 5 comments

Comments

@daxro
Copy link

daxro commented Nov 26, 2018

This issue pertains to the following package(s):

  • [ ? ] GraphQL Playground - Electron App
  • [ x ] GraphQL Playground HTML
  • [ ? ] GraphQL Playground
  • [ ? ] GraphQL Playground Express Middleware
  • [ ? ] GraphQL Playground Hapi Middleware
  • [ ? ] GraphQL Playground Koa Middleware
  • [ ? ] GraphQL Playground Lambda Middleware

What OS and OS version are you experiencing the issue(s) on?

Chrome v 70

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

https://www.graphqlbin.com/v2/

What is the expected behavior?

Don't open and focus on "New Tab" when sharing playground.

What is the actual behavior?

"New Tab" is opened and focused.

What steps may we take to reproduce the behavior?

  1. Rename "New Tab" and change the query
  2. Share playground
  3. Go to shared playhround

Please provide a gif or image of the issue for a quicker response/fix.
Example here: https://graphqlbin.com/v2/yo8yfN

@lorensr
Copy link

lorensr commented Dec 12, 2018

Confirming. Below is how it looks. Prefer the old v1 behavior that did not create a new tab.

When clicking share:

image

When visiting link:

image

@zhammer
Copy link
Contributor

zhammer commented Dec 16, 2018

@HuVik is this an intentional change?

@zhammer
Copy link
Contributor

zhammer commented Dec 17, 2018

it seems like the new tab is a side effect of INJECT_HEADERS. skippingINJECT_HEADERS in redux devtools when on a shared workspace doesn't create a new tab / keeps focus on initial tab.

graphql-playground-redux-history

@zhammer
Copy link
Contributor

zhammer commented Dec 17, 2018

@zhammer
Copy link
Contributor

zhammer commented Dec 17, 2018

outside of this change fixing the issue for shared playgrounds without injected headers, it seems like this logic itself is broken

  -447,7 +447,7 @@ const reducer = handleActions(
     // it makes sure, that there definitely is a tab open with the correct header
     INJECT_HEADERS: (state, { payload: { headers, endpoint } }) => {
       // if there are no headers to inject, there's nothing to do
-      if (!headers || headers === '') {
+      if (!headers || headers === '' || Object.keys(headers).length === 0) {
         return state
       }
       const headersString =

zhammer added a commit to zhammer/graphql-playground that referenced this issue Dec 18, 2018
An empty headers dict currently is not treated as having 'no headers to inject'
Discussed in: graphql#893
huv1k pushed a commit that referenced this issue Jan 14, 2019
* Update headers are empty check on INJECT_HEADERS

An empty headers dict currently is not treated as having 'no headers to inject'
Discussed in: #893

* Accidentally changed line
cgxxv pushed a commit to cgxxv/graphql-playground that referenced this issue Mar 25, 2022
* Update headers are empty check on INJECT_HEADERS

An empty headers dict currently is not treated as having 'no headers to inject'
Discussed in: graphql#893

* Accidentally changed line
filippbudko added a commit to filippbudko/graphql-playground that referenced this issue Jan 16, 2023
* Update headers are empty check on INJECT_HEADERS

An empty headers dict currently is not treated as having 'no headers to inject'
Discussed in: graphql/graphql-playground#893

* Accidentally changed line
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

No branches or pull requests

3 participants