Skip to content

Commit 1dc6d1a

Browse files
committed
fix: pass fix endpoint from the props and removed unused redux code
1 parent 52e9d27 commit 1dc6d1a

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

packages/graphql-playground-react/src/components/Playground.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export interface Props {
6262
subscriptionEndpoint?: string
6363
projectId?: string
6464
shareEnabled?: boolean
65-
adminAuthToken?: string
65+
fixedEndpoint?: boolean
6666
onSuccess?: (graphQLParams: any, response: any) => void
6767
isEndpoint?: boolean
6868
isApp?: boolean
@@ -294,6 +294,7 @@ export class Playground extends React.PureComponent<Props & ReduxProps, State> {
294294
) : (
295295
<GraphQLEditor
296296
shareEnabled={this.props.shareEnabled}
297+
fixedEndpoint={this.props.fixedEndpoint}
297298
schema={this.state.schema}
298299
/>
299300
)}

packages/graphql-playground-react/src/components/Playground/GraphQLEditor.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ import { ResponseRecord } from '../../state/sessions/reducers'
7575
export interface Props {
7676
onRef?: any
7777
shareEnabled?: boolean
78+
fixedEndpoint?: boolean
7879
schema?: GraphQLSchema
7980
}
8081

@@ -167,7 +168,10 @@ class GraphQLEditor extends React.PureComponent<Props & ReduxProps> {
167168
return (
168169
<Container>
169170
<EditorWrapper>
170-
<TopBar shareEnabled={this.props.shareEnabled} />
171+
<TopBar
172+
shareEnabled={this.props.shareEnabled}
173+
fixedEndpoint={this.props.fixedEndpoint}
174+
/>
171175
<EditorBar
172176
ref={this.setEditorBarComponent}
173177
onMouseDown={this.handleResizeStart}

packages/graphql-playground-react/src/components/Playground/TopBar/TopBar.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
getEndpointUnreachable,
1313
} from '../../../state/sessions/selectors'
1414
import { connect } from 'react-redux'
15-
import { getFixedEndpoint } from '../../../state/general/selectors'
1615
import * as PropTypes from 'prop-types'
1716
import {
1817
editEndpoint,
@@ -138,7 +137,6 @@ class TopBar extends React.Component<Props, {}> {
138137

139138
const mapStateToProps = createStructuredSelector({
140139
endpoint: getEndpoint,
141-
fixedEndpoint: getFixedEndpoint,
142140
isReloadingSchema: getIsReloadingSchema,
143141
endpointUnreachable: getEndpointUnreachable,
144142
})

packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export interface PlaygroundWrapperProps {
4545
setTitle?: boolean
4646
settings?: ISettings
4747
shareEnabled?: string
48+
fixedEndpoint?: string
4849
folderName?: string
4950
configString?: string
5051
showNewWorkspace?: boolean
@@ -391,6 +392,7 @@ class PlaygroundWrapper extends React.Component<
391392
onSaveConfig={this.handleSaveConfig}
392393
onUpdateSessionCount={this.handleUpdateSessionCount}
393394
fixedEndpoints={Boolean(this.state.configString)}
395+
fixedEndpoint={this.props.fixedEndpoint}
394396
headers={combinedHeaders}
395397
configPath={this.props.configPath}
396398
workspaceName={

packages/graphql-playground-react/src/state/general/reducers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ import { handleActions } from 'redux-actions'
33

44
export class GeneralState extends Record({
55
historyOpen: false,
6-
fixedEndpoint: false,
76
endpoint: '',
87
configString: '',
98
envVars: {},
109
}) {
1110
historyOpen: boolean
12-
fixedEndpoint: boolean
1311
endpoint: string
1412
configString: string
1513
envVars: any

packages/graphql-playground-react/src/state/general/selectors.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ const makeGeneralSelector = key => state => {
22
return state.general.get(key)
33
}
44

5-
export const getFixedEndpoint = makeGeneralSelector('fixedEndpoint')
65
export const getHistoryOpen = makeGeneralSelector('historyOpen')
76
export const getConfigString = makeGeneralSelector('configString')

0 commit comments

Comments
 (0)