You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v6: Retire the composable GraphiQL.Toolbar and GraphiQL.Logo slots (#4425)
## Summary
- Remove the composable `GraphiQL.Toolbar` and `GraphiQL.Logo` slots.
#4398 already stopped rendering their v5 defaults, leaving them in an
awkward half-fit spot with nowhere natural left to render; this finishes
the job by removing the slots themselves.
- `GraphiQL.Toolbar` is a straight removal, no deprecation period first.
Custom editor actions belong on a plugin's `sessionActions` now,
rendered into the tab strip alongside Prettify/Merge/Copy/Save.
- `GraphiQL.Logo` is removed now that `<TopBar>` takes a new `brand`
prop (any `ReactNode`), which is also exposed straight off `<GraphiQL>`.
It replaces the default hexagon icon + "GraphiQL" wordmark; leave it
unset to keep the default.
- `GraphiQL.Footer` is untouched.
- Also drops the dead
`toolbar.additionalContent`/`toolbar.additionalComponent` `TypeError`
guards, since they pointed at the component being removed here, and the
`.graphiql-toolbar`/`.graphiql-logo` CSS those slots used.
- Updates the README and the v6 migration guide with before/after
snippets, and migrates the `graphiql-vite-react-router` example off both
slots.
Builds on #4398.
## Test plan
- [x] Render `<GraphiQL>` with no extra props. The top bar shows the
default hexagon icon and "GraphiQL" wordmark.
- [x] Render `<GraphiQL brand="My Company">`. The top bar shows "My
Company" instead, and the default wordmark is gone.
- [x] Confirm the old `GraphiQL.Toolbar`/`GraphiQL.Logo` slots are gone:
referencing `<GraphiQL.Toolbar>` or `<GraphiQL.Logo>` as JSX children is
now a TypeScript error, and there's no runtime path that renders them.
- [x] Confirm toolbar actions still work from the tab strip: Prettify,
Merge Fragments, Copy, and Save each appear once and behave as before.
- [x] Register a plugin with a `sessionActions` component and confirm it
renders in the tab strip alongside the built-in actions.
- [x] Confirm `<GraphiQL.Footer>` still renders below the response,
unchanged.
- [x] Run the `graphiql-vite-react-router` example and confirm the
branding shows "API Explorer" and the share-query button still works
from the tab strip.
Refs: #4228 (builds on #4398)
Remove the composable `GraphiQL.Toolbar` and `GraphiQL.Logo` slots. Editor actions are now contributed through a plugin's `sessionActions`, and branding is customized through the `brand` prop passed to `<GraphiQL>` (or `<TopBar>` directly). `GraphiQL.Footer` is unchanged. See the migration guide for before/after examples.
Copy file name to clipboardExpand all lines: docs/migration/graphiql-6.0.0.md
+96-8Lines changed: 96 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Upgrading `graphiql` to `6.0.0`
2
2
3
-
GraphiQL 6 is a visual redesign built on a new OKLCH color system, plus a handful of mostly additive API changes: a `Transport` API that sits alongside the existing `Fetcher`, a settings dialog for theme/density/font-size, and two new first-party plugins (a visual query builder and operation collections) installed by default. The one breaking change is that the hooks deprecated in v5 are now removed, each with a drop-in replacement. See [discussion #4219](https://github.com/graphql/graphiql/discussions/4219) for the design background and to leave feedback.
3
+
GraphiQL 6 is a visual redesign built on a new OKLCH color system, plus a handful of mostly additive API changes: a `Transport` API that sits alongside the existing `Fetcher`, a settings dialog for theme/density/font-size, and two new first-party plugins (a visual query builder and operation collections) installed by default. The breaking changes are the removal of the hooks deprecated in v5 and the removal of the `GraphiQL.Toolbar` / `GraphiQL.Logo` composable slots, each with a drop-in replacement. See [discussion #4219](https://github.com/graphql/graphiql/discussions/4219) for the design background and to leave feedback.
4
4
5
5
If something in your integration breaks that isn't covered here, please open an issue and we'll add it.
6
6
@@ -9,18 +9,19 @@ If something in your integration breaks that isn't covered here, please open an
8.[Theme, density, and font-size settings](#theme-density-and-font-size-settings)
17
+
9.[Considering for removal in v7](#considering-for-removal-in-v7)
18
+
10.[Other notes](#other-notes)
18
19
19
20
## Overview
20
21
21
22
Visually, v6 introduces a new OKLCH-based design-token system, restyles every primitive component (buttons, dialogs, tabs, dropdowns, tooltips), and reworks the app chrome around a top bar, an activity rail, and a side panel. Functionally, the biggest changes are a new `Transport` API for the network layer, the active operation following your cursor instead of only updating on run, and two new default-installed plugins: a visual query builder and operation collections.
22
23
23
-
Most of this is additive and requires no rewrite: the old `fetcher` prop and the old CSS variables keep working. The one breaking change to watch for is the removal of the hooks that were deprecated back in v5 (`useEditorContext`, `usePluginContext`, and the rest). Each has a direct replacement, covered below. Read the sections relevant to your setup and treat the rest as optional cleanup.
24
+
Most of this is additive and requires no rewrite: the old `fetcher` prop and the old CSS variables keep working. Two things to watch for: the hooks that were deprecated back in v5 (`useEditorContext`, `usePluginContext`, and the rest) are now removed, and the composable `GraphiQL.Toolbar` / `GraphiQL.Logo` children are gone in favor of a plugin `sessionActions` and a `brand` prop on the top bar. Each has a direct replacement, covered below. Read the sections relevant to your setup and treat the rest as optional cleanup.
See the [`@graphiql/react` README](../../packages/graphiql-react/README.md#available-stores) for the full list of available store selectors and actions.
197
198
199
+
## Removed `GraphiQL.Toolbar` and `GraphiQL.Logo`
200
+
201
+
`<GraphiQL.Toolbar>` and `<GraphiQL.Logo>` are removed. Both were compound-component children you passed to `<GraphiQL>` to customize the editor toolbar and the corner branding; in v6 those render sites don't exist anymore (the toolbar's default prettify/merge/copy actions and the corner logo were already removed from the default render in a prior v6 change), so the slots had nowhere natural left to render. `<GraphiQL.Footer>` is unchanged and still works exactly as before.
202
+
203
+
### `GraphiQL.Toolbar` → plugin `sessionActions`
204
+
205
+
Custom editor actions now live in the tab strip, next to prettify/merge/copy/save, through a plugin's `sessionActions`: an always-mounted component every registered plugin can provide, regardless of whether that plugin's pane is visible.
Prettify, merge, and copy no longer need re-wiring: they're built into the tab strip by default. Passing the `plugins` prop replaces the default-installed plugin set (as it always has), so include the ones you still want (`HISTORY_PLUGIN`, `QUERY_BUILDER_PLUGIN`, `collectionsPlugin()`) alongside your own.
265
+
266
+
### `GraphiQL.Logo` → the top bar's `brand` prop
267
+
268
+
Branding is customized through a `brand` prop passed straight to `<GraphiQL>` (or to `<TopBar>` directly if you're composing your own layout with `GraphiQLInterface`). It accepts any `ReactNode` and replaces the default hexagon icon + "GraphiQL" wordmark; leave it unset to keep the default.
269
+
270
+
**Before:**
271
+
272
+
```tsx
273
+
<GraphiQLfetcher={fetcher}>
274
+
<GraphiQL.Logo>My Company</GraphiQL.Logo>
275
+
</GraphiQL>
276
+
```
277
+
278
+
**After:**
279
+
280
+
```tsx
281
+
<GraphiQLfetcher={fetcher}brand="My Company" />
282
+
```
283
+
284
+
`brand` isn't limited to text — pass any element, like your own logo image alongside a label.
285
+
198
286
## New `transport` prop
199
287
200
288
`@graphiql/toolkit` adds `createTransport`, which takes the same options as `createGraphiQLFetcher` and produces a `Transport`. Unlike `Fetcher`, a `Transport`'s response carries the real HTTP wire data: status code, headers, body, timing, and request/response sizes. `<GraphiQL>` accepts a new `transport` prop alongside the existing `fetcher` prop; the two are mutually exclusive at the type level. The old API still works, unchanged.
0 commit comments