Skip to content

Commit 86b92d9

Browse files
committed
fix circle, fix websockets
1 parent af501d7 commit 86b92d9

File tree

5 files changed

+50
-6
lines changed

5 files changed

+50
-6
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- run: sudo npm i -g yarn
1111
- run: yarn show-versions
1212
- run: yarn install
13-
- run: cd packages/graphql-playground-react && yarn build
13+
- run: cd packages/graphql-playground-react && yarn && yarn build
1414

1515
electron-build:
1616
macos:

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default class MiddlewareApp extends React.Component<Props, State> {
9393
getParameterByName('endpoint') ||
9494
location.href
9595

96-
let subscriptionEndpoint: string | undefined | null =
96+
let subscriptionEndpoint: any =
9797
props.subscriptionEndpoint || getParameterByName('subscriptionEndpoint')
9898

9999
if (props.configString && props.config && activeEnv) {
@@ -105,15 +105,16 @@ export default class MiddlewareApp extends React.Component<Props, State> {
105105
subscriptionEndpoint = this.getGraphcoolSubscriptionEndpoint(endpoint)
106106
}
107107

108+
subscriptionEndpoint =
109+
this.normalizeSubscriptionUrl(endpoint, subscriptionEndpoint) || undefined
110+
108111
this.state = {
109112
endpoint: this.absolutizeUrl(endpoint),
110113
platformToken:
111114
props.platformToken ||
112115
localStorage.getItem('platform-token') ||
113116
undefined,
114-
subscriptionEndpoint: subscriptionEndpoint
115-
? this.normalizeSubscriptionUrl(endpoint, subscriptionEndpoint)
116-
: '',
117+
subscriptionEndpoint,
117118
settingsString,
118119
settings: this.getSettings(settingsString),
119120
configIsYaml,

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,23 @@ export class GraphQLEditor extends React.PureComponent<
350350
return ''
351351
}
352352

353+
tokenInvalid() {
354+
if (this.state.responses.length === 1) {
355+
const response = this.state.responses[0].date
356+
if (response) {
357+
try {
358+
const data = JSON.parse(response)
359+
if (data && data.errors && data.errors[0].code === 3015) {
360+
return true
361+
}
362+
} catch (e) {
363+
//
364+
}
365+
}
366+
}
367+
return false
368+
}
369+
353370
render() {
354371
const children = React.Children.toArray(this.props.children)
355372
const footer = find(children, child => child.type === GraphQLEditor.Footer)

packages/graphql-playground-react/src/components/Playground/SchemaFetcher.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ export class SchemaFetcher {
3838
})
3939
const schemaData = await response.json()
4040

41-
if (!schemaData || schemaData.error || !schemaData.data) {
41+
if (schemaData && (schemaData.errors || !schemaData.data)) {
42+
throw new Error(JSON.stringify(schemaData, null, 2))
43+
}
44+
45+
if (!schemaData) {
4246
throw new NoSchemaError(endpoint)
4347
}
4448

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import * as React from 'react'
2+
import Tooltip from '../Tooltip'
3+
4+
export default class TokenTooltip extends React.Component {
5+
render() {
6+
return (
7+
<Tooltip
8+
open={true}
9+
onClose={this.handleToggle}
10+
anchorOrigin={{
11+
vertical: 'top',
12+
horizontal: 'left',
13+
}}
14+
>
15+
<h1>This is the tooltip</h1>
16+
</Tooltip>
17+
)
18+
}
19+
handleToggle = () => {
20+
//
21+
}
22+
}

0 commit comments

Comments
 (0)