Skip to content

Commit 4af733e

Browse files
committed
fix: schema reloading
1 parent 66f4a05 commit 4af733e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export interface ReduxProps {
100100
setConfigString: (str: string) => void
101101
schemaFetchingError: (endpoint: string, error: string) => void
102102
schemaFetchingSuccess: (endpoint: string, tracingSupported: boolean) => void
103+
isReloadingSchema: boolean
103104
isConfigTab: boolean
104105
isSettingsTab: boolean
105106
isFile: boolean
@@ -177,8 +178,10 @@ export class Playground extends React.PureComponent<Props & ReduxProps, State> {
177178
) {
178179
this.getSchema(nextProps)
179180
}
180-
if (nextProps.isReloadingSchema) {
181-
this.getSchema(nextProps)
181+
if (this.props.isReloadingSchema && !nextProps.isReloadingSchema) {
182+
setTimeout(() => {
183+
this.getSchema(nextProps)
184+
})
182185
}
183186
if (
184187
this.props.endpoint !== nextProps.endpoint ||
@@ -240,6 +243,8 @@ export class Playground extends React.PureComponent<Props & ReduxProps, State> {
240243
this.backoff.stop()
241244
}
242245
} catch (e) {
246+
// tslint:disable-next-line
247+
console.error(e)
243248
this.props.schemaFetchingError(props.endpoint, e.message)
244249
}
245250
}

0 commit comments

Comments
 (0)