graphiql
graphiql copied to clipboard
[v2] add provider component and deduplicate prop type definitions
More cleanup for v2: This PR adds a GraphiQLProvider
component that renders all the providers from @graphiql/react
. I also deduplicated the prop definitions and moved them to where they originate. The JSDocs still show up for individual props when using the GraphiQL
component.
We also export a new component GraphiQLInterface
, which essentially is everything but the providers. This will enable users to extend GraphiQL with something like the OneGraph Explorer:
import { GraphiQLProvider } from '@graphiql/react'
import { GraphiQLInterface } from 'graphiql'
import GraphiQLExplorer from 'graphiql-explorer'
function CustomGraphiQL() {
return (
<GraphiQLProvider>
<CustomGraphiQLWithProviders />
</GraphiQLProvider>
)
}
function CustomGraphiQLWithProviders() {
// Use hooks to access and change GraphiQL state here
return (
<div>
<GraphiQLExplorer />
<GraphiQLInterface />
</div>
)
}
🦋 Changeset detected
Latest commit: fd733011edb48d8e91d251b35239c4ba53961c15
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 2 packages
Name | Type |
---|---|
@graphiql/react | Minor |
graphiql | Major |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Codecov Report
Merging #2650 (fd73301) into graphiql-v2 (32566ab) will increase coverage by
0.06%
. The diff coverage is65.11%
.
@@ Coverage Diff @@
## graphiql-v2 #2650 +/- ##
===============================================
+ Coverage 58.36% 58.42% +0.06%
===============================================
Files 92 92
Lines 5313 5333 +20
Branches 1746 1761 +15
===============================================
+ Hits 3101 3116 +15
- Misses 2191 2196 +5
Partials 21 21
Impacted Files | Coverage Δ | |
---|---|---|
packages/graphiql-react/src/editor/context.tsx | 3.44% <ø> (ø) |
|
...ckages/graphiql-react/src/editor/header-editor.tsx | 1.96% <ø> (ø) |
|
packages/graphiql-react/src/editor/hooks.ts | 0.00% <ø> (ø) |
|
...ackages/graphiql-react/src/editor/query-editor.tsx | 1.68% <ø> (ø) |
|
...ages/graphiql-react/src/editor/response-editor.tsx | 0.00% <0.00%> (ø) |
|
packages/graphiql-react/src/editor/tabs.ts | 5.66% <ø> (ø) |
|
...ages/graphiql-react/src/editor/variable-editor.tsx | 1.88% <ø> (ø) |
|
packages/graphiql-react/src/execution.tsx | 1.55% <0.00%> (-0.03%) |
:arrow_down: |
packages/graphiql-react/src/schema.tsx | 1.92% <0.00%> (-0.04%) |
:arrow_down: |
packages/graphiql-react/src/storage.tsx | 18.18% <ø> (ø) |
|
... and 4 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.