Skip to content

Commit

Permalink
fix: pass fix endpoint from the props and removed unused redux code
Browse files Browse the repository at this point in the history
  • Loading branch information
pantharshit00 committed Dec 14, 2018
1 parent 52e9d27 commit 2a372ce
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/graphql-playground-react/public/index.html
Expand Up @@ -530,6 +530,7 @@
GraphQLPlayground.init(root, {
"env": "react",
"canSaveConfig": false,
"fixedEndpoint": true,
"headers": {
"test": "test",
}
Expand Down
Expand Up @@ -62,7 +62,7 @@ export interface Props {
subscriptionEndpoint?: string
projectId?: string
shareEnabled?: boolean
adminAuthToken?: string
fixedEndpoint?: boolean
onSuccess?: (graphQLParams: any, response: any) => void
isEndpoint?: boolean
isApp?: boolean
Expand Down Expand Up @@ -294,6 +294,7 @@ export class Playground extends React.PureComponent<Props & ReduxProps, State> {
) : (
<GraphQLEditor
shareEnabled={this.props.shareEnabled}
fixedEndpoint={this.props.fixedEndpoint}
schema={this.state.schema}
/>
)}
Expand Down
Expand Up @@ -75,6 +75,7 @@ import { ResponseRecord } from '../../state/sessions/reducers'
export interface Props {
onRef?: any
shareEnabled?: boolean
fixedEndpoint?: boolean
schema?: GraphQLSchema
}

Expand Down Expand Up @@ -167,7 +168,10 @@ class GraphQLEditor extends React.PureComponent<Props & ReduxProps> {
return (
<Container>
<EditorWrapper>
<TopBar shareEnabled={this.props.shareEnabled} />
<TopBar
shareEnabled={this.props.shareEnabled}
fixedEndpoint={this.props.fixedEndpoint}
/>
<EditorBar
ref={this.setEditorBarComponent}
onMouseDown={this.handleResizeStart}
Expand Down
Expand Up @@ -12,7 +12,6 @@ import {
getEndpointUnreachable,
} from '../../../state/sessions/selectors'
import { connect } from 'react-redux'
import { getFixedEndpoint } from '../../../state/general/selectors'
import * as PropTypes from 'prop-types'
import {
editEndpoint,
Expand Down Expand Up @@ -138,7 +137,6 @@ class TopBar extends React.Component<Props, {}> {

const mapStateToProps = createStructuredSelector({
endpoint: getEndpoint,
fixedEndpoint: getFixedEndpoint,
isReloadingSchema: getIsReloadingSchema,
endpointUnreachable: getEndpointUnreachable,
})
Expand Down
Expand Up @@ -45,6 +45,7 @@ export interface PlaygroundWrapperProps {
setTitle?: boolean
settings?: ISettings
shareEnabled?: string
fixedEndpoint?: string
folderName?: string
configString?: string
showNewWorkspace?: boolean
Expand Down Expand Up @@ -391,6 +392,7 @@ class PlaygroundWrapper extends React.Component<
onSaveConfig={this.handleSaveConfig}
onUpdateSessionCount={this.handleUpdateSessionCount}
fixedEndpoints={Boolean(this.state.configString)}
fixedEndpoint={this.props.fixedEndpoint}
headers={combinedHeaders}
configPath={this.props.configPath}
workspaceName={
Expand Down
Expand Up @@ -3,13 +3,11 @@ import { handleActions } from 'redux-actions'

export class GeneralState extends Record({
historyOpen: false,
fixedEndpoint: false,
endpoint: '',
configString: '',
envVars: {},
}) {
historyOpen: boolean
fixedEndpoint: boolean
endpoint: string
configString: string
envVars: any
Expand Down
Expand Up @@ -2,6 +2,5 @@ const makeGeneralSelector = key => state => {
return state.general.get(key)
}

export const getFixedEndpoint = makeGeneralSelector('fixedEndpoint')
export const getHistoryOpen = makeGeneralSelector('historyOpen')
export const getConfigString = makeGeneralSelector('configString')

0 comments on commit 2a372ce

Please sign in to comment.