Skip to content

Commit a43266e

Browse files
committed
add endpoint backoff
1 parent 7f1332f commit a43266e

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

packages/graphql-playground/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
npm publish
5+
#npm publish
66

77
curl -X POST \
88
http://purge.jsdelivr.net/ \

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,13 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
236236
}
237237

238238
componentWillUnmount() {
239-
this.storage.setItem(
240-
'selectedSessionIndex',
241-
String(this.state.selectedSessionIndex),
242-
)
243-
this.saveSessions()
244-
this.saveHistory()
245-
this.storage.saveProject()
239+
// this.storage.setItem(
240+
// 'selectedSessionIndex',
241+
// String(this.state.selectedSessionIndex),
242+
// )
243+
// this.saveSessions()
244+
// this.saveHistory()
245+
// this.storage.saveProject()
246246
}
247247

248248
setWS = (session: Session) => {
@@ -340,6 +340,7 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
340340
isGraphcoolUrl={isGraphcoolUrl}
341341
fetcher={this.fetcher}
342342
isEndpoint={Boolean(isEndpoint)}
343+
endpoint={this.props.endpoint}
343344
storage={this.storage.getSessionStorage(session.id)}
344345
onClickCodeGeneration={this.handleClickCodeGeneration}
345346
onEditOperationName={this.handleOperationNameChange}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export interface Props {
8181
hideGutters?: boolean
8282
readonly?: boolean
8383
useVim?: boolean
84+
endpoint: string
8485

8586
// sharing
8687
sharing?: SharingProps
@@ -472,7 +473,7 @@ export class GraphQLEditor extends React.PureComponent<
472473
`}</style>
473474
<div className="editorWrap">
474475
<TopBar
475-
endpoint={this.props.session.endpoint}
476+
endpoint={this.props.session.endpoint || this.props.endpoint}
476477
endpointDisabled={false}
477478
onChangeEndpoint={this.props.onChangeEndpoint}
478479
onClickHistory={this.props.onClickHistory}
@@ -705,7 +706,7 @@ export class GraphQLEditor extends React.PureComponent<
705706

706707
private reloadSchema = async () => {
707708
const result = await this.props.schemaFetcher.refetch(
708-
this.props.session.endpoint,
709+
this.props.session.endpoint || this.props.endpoint,
709710
this.convertHeaders(this.props.session.headers),
710711
)
711712
if (result) {
@@ -746,7 +747,7 @@ export class GraphQLEditor extends React.PureComponent<
746747

747748
this.props.schemaFetcher
748749
.fetch(
749-
this.props.session.endpoint,
750+
this.props.session.endpoint || this.props.endpoint,
750751
this.convertHeaders(this.props.session.headers),
751752
)
752753
.then(result => {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface Props {
2929
isActive: boolean
3030
sharing?: SharingProps
3131
fixedEndpoint?: boolean
32+
endpoint: string
3233
}
3334

3435
export default class GraphQLEditorSession extends React.PureComponent<
@@ -50,9 +51,11 @@ export default class GraphQLEditorSession extends React.PureComponent<
5051
schemaFetcher,
5152
sharing,
5253
fixedEndpoint,
54+
endpoint,
5355
} = this.props
5456
return (
5557
<GraphQLEditor
58+
endpoint={endpoint}
5659
isActive={isActive}
5760
key={session.id}
5861
isGraphcoolUrl={isGraphcoolUrl}

packages/graphql-playground/src/components/PlaygroundStorage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ export default class PlaygroundStorage {
196196
try {
197197
result = JSON.parse(localStorage.getItem(this.endpoint) || '')
198198
} catch (e) {
199+
/* tslint:disable-next-line */
200+
console.info(e)
199201
//
200202
}
201203
if (result && result.history) {

0 commit comments

Comments
 (0)