Skip to content

Commit 5291322

Browse files
[v2] cleanup GraphiQL component (#2632)
* remove deprecated class methods * remove utilities * remove ref forwarding * refactor inner class component to a function component * merge main component with context consumer component * remove component statics * refactor outer component to be a class component * remove comments * add changeset * remove legacy exports
1 parent 82e9d99 commit 5291322

File tree

8 files changed

+535
-937
lines changed

8 files changed

+535
-937
lines changed

.changeset/real-waves-enjoy.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
---
44

55
BREAKING: The following static properties of the `GraphiQL` component have been removed:
6+
- `GraphiQL.formatResult`: You can use the function `formatResult` from `@graphiql/toolkit` instead.
7+
- `GraphiQL.formatError`: You can use the function `formatError` from `@graphiql/toolkit` instead.
8+
- `GraphiQL.QueryEditor`: You can use the `QueryEditor` component from `@graphiql/react` instead.
9+
- `GraphiQL.VariableEditor`: You can use the `VariableEditor` component from `@graphiql/react` instead.
10+
- `GraphiQL.HeaderEditor`: You can use the `HeaderEditor` component from `@graphiql/react` instead.
11+
- `GraphiQL.ResultViewer`: You can use the `ResponseEditor` component from `@graphiql/react` instead.
612
- `GraphiQL.Button`: You can use the `ToolbarButton` component from `@graphiql/react` instead.
713
- `GraphiQL.ToolbarButton`: This exposed the same component as `GraphiQL.Button`.
814
- `GraphiQL.Menu`: You can use the `ToolbarMenu` component from `@graphiql/react` instead.

.changeset/red-zoos-divide.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@
55
BREAKING: The following exports of the `graphiql` package have been removed:
66
- `DocExplorer`: Now exported from `@graphiql/react` as `DocExplorer`
77
- The `schema` prop has been removed, the component now uses the schema provided by the `ExplorerContext`
8+
- `fillLeafs`: Now exported from `@graphiql/toolkit` as `fillLeafs`
9+
- `getSelectedOperationName`: Now exported from `@graphiql/toolkit` as `getSelectedOperationName`
10+
- `mergeAst`: Now exported from `@graphiql/toolkit` as `mergeAst`
11+
- `onHasCompletion`: Now exported from `@graphiql/react` as `onHasCompletion`
12+
- `QueryEditor`: Now exported from `@graphiql/react` as `QueryEditor`
813
- `ToolbarMenu`: Now exported from `@graphiql/react` as `ToolbarMenu`
914
- `ToolbarMenuItem`: Now exported from `@graphiql/react` as `ToolbarMenu.Item`
1015
- `ToolbarSelect`: Now exported from `@graphiql/react` as `ToolbarListbox`
1116
- `ToolbarSelectOption`: Now exported from `@graphiql/react` as `ToolbarListbox.Option`
17+
- `VariableEditor`: Now exported from `@graphiql/react` as `VariableEditor`
18+
- type `Fetcher`: Now exported from `@graphiql/toolkit`
19+
- type `FetcherOpts`: Now exported from `@graphiql/toolkit`
20+
- type `FetcherParams`: Now exported from `@graphiql/toolkit`
21+
- type `FetcherResult`: Now exported from `@graphiql/toolkit`
22+
- type `FetcherReturnType`: Now exported from `@graphiql/toolkit`
23+
- type `Observable`: Now exported from `@graphiql/toolkit`
24+
- type `Storage`: Now exported from `@graphiql/toolkit`
25+
- type `SyncFetcherResult`: Now exported from `@graphiql/toolkit`

.changeset/rude-houses-kiss.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphiql': major
3+
---
4+
5+
BREAKING: The `GraphiQL` component has been refactored to be a function component. Attaching a ref to this component will no longer provide access to props, state or class methods. In order to interact with or change `GraphiQL` state you need to use the contexts and hooks provided by the `@graphiql/react` package. More details and examples can be found in the migration guide.

0 commit comments

Comments
 (0)