diff --git a/packages/gatsby-graphiql-explorer/src/app.jsx b/packages/gatsby-graphiql-explorer/src/app.jsx index b93852c6361c1..297245917f5db 100644 --- a/packages/gatsby-graphiql-explorer/src/app.jsx +++ b/packages/gatsby-graphiql-explorer/src/app.jsx @@ -108,9 +108,22 @@ const App = ({ initialExternalFragments }) => { const fetchData = async () => { const result = await graphQLIntrospection() + let { enableRefresh, refreshToken } = result.extensions + + switch (typeof enableRefresh) { + case `string`: { + const lowerCased = enableRefresh.toLowerCase() + enableRefresh = lowerCased === `1` || lowerCased === `true` + break + } + case `number`: + enableRefresh = enableRefresh > 0 + break + } + setRefreshState({ - enableRefresh: !!+result.extensions.enableRefresh, - refreshToken: result.extensions.refreshToken, + enableRefresh, + refreshToken, }) }