Graphql-playground: RenderPageOptions.settings is ignored

Created on 19 Jun 2018  路  5Comments  路  Source: graphql/graphql-playground

This issue pertains to the following package(s):

  • [ ] GraphQL Playground - Electron App
  • [*] 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?

OSX

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

1.7.0

What is the expected behavior?

When providing RenderPageOptions.settings the page should open with those effective, instead of the default values.

    const options: RenderPageOptions = {
      endpoint: url,
      settings: {
        'general.betaUpdates': false,
        'editor.fontSize': 12,
        'editor.fontFamily': "'Menlo', 'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace'",
        'editor.theme': 'light',
        'editor.reuseHeaders': true,
        'request.credentials': 'omit',
        'tracing.hideTracingResponse': true,
      },
      version: playgroundVersion,
    };
    return renderPlaygroundPage(options);

What is the actual behavior?

The "settings" are ignored, the page always renders with the default settings, the served HTML actually contains the settings given in code. Tested with Chrome incognito window, not a browser caching issue. Once the page opens it is possible to changes the settings in browser.

What steps may we take to reproduce the behavior?

Just try to provide any settings to the renderPlaygroundPage or any of the middleware packages.

_Please provide a gif or image of the issue for a quicker response/fix._

Most helpful comment

it looks to be writing the settings to the DOM prior to client initialisation but is failing to hydrate the redux store settings from props

https://github.com/prismagraphql/graphql-playground/blob/62ecfdb658935a11391701835d15c66a06be68ad/packages/graphql-playground-react/src/components/GraphQLBinApp.tsx#L42-L51

All 5 comments

I'm seeing this as well, trying the minimal page with 1.7.0

GraphQLPlayground.init(root, {
  endpoint: location.protocol + '//' + path,
  settings: {
    'request.credentials': 'same-origin'
  }
})

Settings seem to be ignored both with empty localStorage and after first load -- but can still be changed manually from the interface.

it looks to be writing the settings to the DOM prior to client initialisation but is failing to hydrate the redux store settings from props

https://github.com/prismagraphql/graphql-playground/blob/62ecfdb658935a11391701835d15c66a06be68ad/packages/graphql-playground-react/src/components/GraphQLBinApp.tsx#L42-L51

Any progress here?

seeing this issue as well when configuring through apollo 2, would like to see this fixed

It should be fixed, if its still problem please reopen.

Was this page helpful?
0 / 5 - 0 ratings