Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
huv1k authored and timsuchanek committed Aug 1, 2018
1 parent 5234295 commit 9821ae1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function* runQuerySaga(action) {
headers,
credentials: settings['request.credentials'],
}

const { link, subscriptionClient } = linkCreator(lol)
yield put(setCurrentQueryStartTime(new Date()))

Expand Down
10 changes: 8 additions & 2 deletions packages/graphql-playground-react/src/state/sessions/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,14 @@ function* addToHistory({ payload }) {
function* prettifyQuery() {
const { query } = yield select(getSelectedSession)
const settings = yield select(getSettings)
const prettyQuery = prettify(query, settings['prettier.printWidth'])
yield put(editQuery(prettyQuery))
try {
const prettyQuery = prettify(query, settings['prettier.printWidth'])
yield put(editQuery(prettyQuery))
} catch (e) {
// TODO show erros somewhere
// tslint:disable-next-line
console.log(e)
}
}

export const sessionsSagas = [
Expand Down
15 changes: 5 additions & 10 deletions packages/graphql-playground-react/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ export function safely(cb: any) {
}

export function prettify(query: string, printWidth: number) {
try {
return prettier.format(query, {
parser: 'graphql',
printWidth,
plugins: [graphql],
})
} catch (e) {
//TODO show erros somewhere
console.log(e)
}
return prettier.format(query, {
parser: 'graphql',
printWidth,
plugins: [graphql],
})
}

0 comments on commit 9821ae1

Please sign in to comment.