diff --git a/packages/graphql-playground-react/src/components/MiddlewareApp.tsx b/packages/graphql-playground-react/src/components/MiddlewareApp.tsx index 7edf748..febd492 100644 --- a/packages/graphql-playground-react/src/components/MiddlewareApp.tsx +++ b/packages/graphql-playground-react/src/components/MiddlewareApp.tsx @@ -1,6 +1,8 @@ import * as React from 'react' import { Provider } from 'react-redux' import createStore from '../state/createStore' +import { getSettings } from '../state/workspace/reducers' +import { setSettingsString } from '../state/general/actions' import PlaygroundWrapper, { PlaygroundWrapperProps } from './PlaygroundWrapper' const store = createStore() @@ -8,6 +10,12 @@ const store = createStore() export default class MiddlewareApp extends React.Component< PlaygroundWrapperProps > { + componentDidMount() { + const initialSettings = getSettings(store.getState()) + const mergedSettings = { ...initialSettings, ...this.props.settings } + const settingsString = JSON.stringify(mergedSettings, null, 2) + store.dispatch(setSettingsString(settingsString)) + } render() { return ( diff --git a/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx b/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx index edb6f74..ec789fa 100644 --- a/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx +++ b/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx @@ -527,7 +527,7 @@ class PlaygroundWrapper extends React.Component< const mapStateToProps = (state, ownProps) => { const theme = ownProps.theme || getTheme(state, ownProps.settings) - const settings = ownProps.settings || getSettings(state) + const settings = getSettings(state) return { theme, settings } }