Skip to content

Commit d2ad342

Browse files
committed
Fix schema refetching
1 parent 97549f1 commit d2ad342

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

packages/graphql-playground-react/src/components/Playground/util/fibonacci-backoff.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export class Backoff {
2121
await this.cb()
2222
this.count++
2323
if (this.running && this.count < this.maxRetries) {
24-
setTimeout(fn, fibonacci(this.count) * 1000)
24+
setTimeout(
25+
fn,
26+
(this.count < 15 ? 3 : fibonacci(this.count - 12)) * 1000,
27+
)
2528
}
2629
}
2730
fn()

packages/graphql-playground-react/src/state/sessions/fetchingSagas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function* runQuerySaga(action) {
179179
if (value && value.extensions) {
180180
const extensions = value.extensions
181181
yield put(setResponseExtensions(extensions))
182-
delete value.extensiosn
182+
delete value.extensions
183183
}
184184
const response = new ResponseRecord({
185185
date: JSON.stringify(value ? value : formatError(error), null, 2),

packages/graphql-playground-react/src/state/sessions/reducers.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,12 @@ const reducer = handleActions(
378378
.set('sessionCount', newState.sessions.size)
379379
},
380380
NEW_SESSION: (state, { payload: { reuseHeaders, endpoint } }) => {
381-
let session = makeSession(
382-
endpoint || state.sessions.first().endpoint,
383-
).set('query', '')
381+
const currentSession = state.sessions.first()
382+
let session = makeSession(endpoint || currentSession.endpoint).merge({
383+
query: '',
384+
isReloadingSchema: currentSession.isReloadingSchema,
385+
endpointUnreachable: currentSession.endpointUnreachable,
386+
})
384387
if (reuseHeaders) {
385388
const selectedSessionId = getSelectedSessionId(state)
386389
const currentSession = state.sessions.get(selectedSessionId)

0 commit comments

Comments
 (0)