From 1dc6d1a66a05494e5e5d3e49a441a48f6fff8060 Mon Sep 17 00:00:00 2001 From: Harshit Pant Date: Fri, 14 Dec 2018 22:22:53 +0530 Subject: [PATCH] fix: pass fix endpoint from the props and removed unused redux code --- .../graphql-playground-react/src/components/Playground.tsx | 3 ++- .../src/components/Playground/GraphQLEditor.tsx | 6 +++++- .../src/components/Playground/TopBar/TopBar.tsx | 2 -- .../src/components/PlaygroundWrapper.tsx | 2 ++ .../graphql-playground-react/src/state/general/reducers.ts | 2 -- .../graphql-playground-react/src/state/general/selectors.ts | 1 - 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/graphql-playground-react/src/components/Playground.tsx b/packages/graphql-playground-react/src/components/Playground.tsx index 02ea09e28..120b74083 100644 --- a/packages/graphql-playground-react/src/components/Playground.tsx +++ b/packages/graphql-playground-react/src/components/Playground.tsx @@ -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 @@ -294,6 +294,7 @@ export class Playground extends React.PureComponent { ) : ( )} diff --git a/packages/graphql-playground-react/src/components/Playground/GraphQLEditor.tsx b/packages/graphql-playground-react/src/components/Playground/GraphQLEditor.tsx index e69514b7b..45ca83628 100644 --- a/packages/graphql-playground-react/src/components/Playground/GraphQLEditor.tsx +++ b/packages/graphql-playground-react/src/components/Playground/GraphQLEditor.tsx @@ -75,6 +75,7 @@ import { ResponseRecord } from '../../state/sessions/reducers' export interface Props { onRef?: any shareEnabled?: boolean + fixedEndpoint?: boolean schema?: GraphQLSchema } @@ -167,7 +168,10 @@ class GraphQLEditor extends React.PureComponent { return ( - + { const mapStateToProps = createStructuredSelector({ endpoint: getEndpoint, - fixedEndpoint: getFixedEndpoint, isReloadingSchema: getIsReloadingSchema, endpointUnreachable: getEndpointUnreachable, }) diff --git a/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx b/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx index 5cec3e4d2..7e29f84e3 100644 --- a/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx +++ b/packages/graphql-playground-react/src/components/PlaygroundWrapper.tsx @@ -45,6 +45,7 @@ export interface PlaygroundWrapperProps { setTitle?: boolean settings?: ISettings shareEnabled?: string + fixedEndpoint?: string folderName?: string configString?: string showNewWorkspace?: boolean @@ -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={ diff --git a/packages/graphql-playground-react/src/state/general/reducers.ts b/packages/graphql-playground-react/src/state/general/reducers.ts index 1720b2c3e..e2d78e503 100644 --- a/packages/graphql-playground-react/src/state/general/reducers.ts +++ b/packages/graphql-playground-react/src/state/general/reducers.ts @@ -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 diff --git a/packages/graphql-playground-react/src/state/general/selectors.ts b/packages/graphql-playground-react/src/state/general/selectors.ts index 8636cde88..5dbccec0c 100644 --- a/packages/graphql-playground-react/src/state/general/selectors.ts +++ b/packages/graphql-playground-react/src/state/general/selectors.ts @@ -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')