GraphiQLExplorer integration incompatible after 1.9 release #2440
-
I've been using OneGraph/GraphiQLExplorer for several years now, honestly I find it to be a make or break feature when using Graphiql. The refactoring that went into 1.9 completely breaks this. Now I'm not complaining about that, I'm pretty sure that the way it was hooked together was depending far too much on implementation details of graphiql, but, it does leave me wondering what the best way to integrate these two together might be. Previously I used to do something like this: const _graphiql = useRef(null)
...
<div className={cx(classes.box, 'graphiql-container')}>
<GraphiQLExplorer
schema={schema}
query={query}
onEdit={handleEditQuery}
onRunOperation={(operationName: string) =>
_graphiql.current.handleRunQuery(operationName)
}
explorerIsOpen={explorerIsOpen}
onToggleExplorer={handleToggleExplorer}
/>
<RealGraphiQL
ref={_graphiql}
fetcher={graphQLFetcher(jwtToken)}
schema={schema}
query={query}
onEditQuery={handleEditQuery}
>
<RealGraphiQL.Toolbar>
<RealGraphiQL.Button
onClick={_graphiql.current.handlePrettifyQuery}
label={t`Prettify`}
title={t`Prettify Query (Shift-Ctrl-P)`}
/>
<RealGraphiQL.Button
onClick={_graphiql.current.handleMergeQuery}
title={t`Merge Query (Shift-Ctrl-M)`}
label={t`Merge`}
/>
...
</RealGraphiQL.Toolbar>
</RealGraphiQL>
</div> It looks like the internal Anyone got a suggestion as to the best way forward here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @ggascoigne 👋 we did indeed break attaching a ref to the |
Beta Was this translation helpful? Give feedback.
Hey @ggascoigne 👋 we did indeed break attaching a ref to the
GraphiQL
class component with 1.9.0, but fixed it later with 1.9.5 and 1.9.6 (see #2454 and #2466). Customizing the toolbar should still work as before. Can you try if the latest version (1.9.6) fixes your issues?