OlegIlyenko / graphiql-workspace

A graphical interactive in-browser GraphQL IDE enhanced with tabbed navigation, HTTP headers, arbitrary endpoints, etc.

Home Page:http://toolbox.sangria-graphql.org/graphiql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instrospection query is run on every keystroke in a tab

tlvenn opened this issue · comments

After a little bit of investigation, the cause of this behaviour is the render method of the GraphiQLTab component, specifically: https://github.com/graphql/graphiql/blob/56150d504323bad8c60d895f0c6a87d95bae0b46/src/components/GraphiQL.js#L175

This will always evaluate to true because nextProps.schema is null which consequently trigger a this._fetchSchema();

This schema prop is passed down from us but it is never initialised when our component mount so unless updateSchema is triggered by the proxy being updated or the url being updated, this.state.schema is always null.

We should trigger a schemaUpdate when we are about to mount the tab.