Skip to content

Commit

Permalink
Remove comments from new sessions. Closes #623
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Apr 2, 2018
1 parent 850c1e0 commit b3b8a57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export class QueryEditor extends React.PureComponent<Props & ReduxProps, {}> {
componentWillReceiveProps(nextProps) {
if (this.props.sessionId !== nextProps.sessionId) {
this.closeCompletion()
this.editor.focus()
}
}

Expand Down
11 changes: 6 additions & 5 deletions packages/graphql-playground-react/src/state/sessions/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ const reducer = handleActions(
.set('sessionCount', newState.sessions.size)
},
NEW_SESSION: (state, { payload: { reuseHeaders, endpoint } }) => {
let session = makeSession(endpoint || state.sessions.first().endpoint)
let session = makeSession(
endpoint || state.sessions.first().endpoint,
).set('query', '')
if (reuseHeaders) {
const selectedSessionId = getSelectedSessionId(state)
const currentSession = state.sessions.get(selectedSessionId)
Expand Down Expand Up @@ -521,10 +523,9 @@ function closeTab(state, sessionId) {
// if there is only one session, delete it and replace it by a new one
// and keep the endpoint & headers of the last one
if (length === 1) {
const newSession = makeSession(session.endpoint).set(
'headers',
session.headers,
)
const newSession = makeSession(session.endpoint)
.set('headers', session.headers)
.set('query', '')
newState = newState.set('selectedSessionId', newSession.id)
return newState.setIn(['sessions', newSession.id], newSession)
}
Expand Down

0 comments on commit b3b8a57

Please sign in to comment.