- Updated dependencies []:
- @graphiql/react@0.20.4
- Updated dependencies [
2b6ea316
]:- @graphiql/react@0.20.3
- Updated dependencies [
e89c432d
]:- @graphiql/react@0.20.2
- Updated dependencies [
39bf31d1
]:- @graphiql/react@0.20.1
- Updated dependencies [
f6afd22d
]:- @graphiql/react@0.20.0
- Updated dependencies []:
- @graphiql/react@0.19.4
- Updated dependencies [
2348641c
]:- @graphiql/react@0.19.3
- Updated dependencies [
d67c13f6
]:- @graphiql/react@0.19.2
-
#3341
e4a36207
Thanks @acao! - Fix code exporter plugin on early init, add hooks -
Updated dependencies [
17069e7a
,e4a36207
]:- @graphiql/react@0.19.1
-
#3330
bed5fc86
Thanks @acao! - BREAKING CHANGE: fix lifecycle issue in plugin-explorer, change implementation patternvalue
andsetValue
is no longer an implementation detail, and are handled internally by plugins. the plugin signature has changed slightly as well.now, instead of something like this:
import { useExplorerPlugin } from '@graphiql/plugin-explorer'; import { snippets } from './snippets'; import { useExporterPlugin } from '@graphiql/plugin-code-exporter'; const App = () => { const [query, setQuery] = React.useState(''); const explorerPlugin = useExplorerPlugin({ query, onEdit: setQuery, }); const codeExporterPlugin = useExporterPlugin({ query, snippets, }); const plugins = React.useMemo( () => [explorerPlugin, codeExporterPlugin], [explorerPlugin, codeExporterPlugin], ); return ( <GraphiQL query={query} onEditQuery={setQuery} plugins={plugins} fetcher={fetcher} /> ); };
you can just do this:
import { explorerPlugin } from '@graphiql/plugin-explorer'; import { snippets } from './snippets'; import { codeExporterPlugin } from '@graphiql/plugin-code-exporter'; import { createGraphiQLFetcher } from '@graphiql/toolkit'; // only invoke these inside the component lifecycle // if there are dynamic values, and then use useMemo() (see below) const explorer = explorerPlugin(); const exporter = codeExporterPlugin({ snippets }); const fetcher = createGraphiQLFetcher({ url: '/graphql' }); const App = () => { return <GraphiQL plugins={[explorer, exporter]} fetcher={fetcher} />; };
or this, for more complex state-driven needs:
import { useMemo } from 'react'; import { explorerPlugin } from '@graphiql/plugin-explorer'; import { snippets } from './snippets'; import { codeExporterPlugin } from '@graphiql/plugin-code-exporter'; const explorer = explorerPlugin(); const fetcher = createGraphiQLFetcher({ url: '/graphql' }); const App = () => { const { snippets } = useMyUserSuppliedState(); const exporter = useMemo( () => codeExporterPlugin({ snippets }), [snippets], ); return <GraphiQL plugins={[explorer, exporter]} fetcher={fetcher} />; };
- #3292
f86e4172
Thanks @B2o5T! - fix umd build namesgraphiql-plugin-code-exporter.umd.js
andgraphiql-plugin-explorer.umd.js
-
#3229
0a65e720
Thanks @B2o5T! - exclude peer dependencies and dependencies from bundle -
#3251
f8d8509b
Thanks @B2o5T! - always bundlepackage.json#dependencies
for UMD build for@graphiql/plugin-code-exporter
and@graphiql/plugin-explorer