Skip to content

GraphiQL 5 #3979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4c872dc
enter rc
dimaMachina Jun 1, 2025
f2e694f
Revert "revert https://github.com/graphql/graphiql/pull/3946 to have …
dimaMachina Jun 1, 2025
7ff9563
Merge branch 'main' into graphiql-5
dimaMachina Jun 3, 2025
0844dc1
[1] various refactor after zustand migration (#3949)
dimaMachina Jun 3, 2025
be5f6bc
Update release.yml
dimaMachina Jun 3, 2025
2455907
[2] remove `useQueryEditor`, `useVariableEditor`, `useHeaderEditor`, …
dimaMachina Jun 3, 2025
9cc2613
Merge branch 'main' into graphiql-5
dimaMachina Jun 4, 2025
47fda9b
Merge branch 'main' into graphiql-5
dimaMachina Jun 4, 2025
8965746
update yarn.lock
dimaMachina Jun 4, 2025
86a96e5
[3] GraphiQL 5 x Monaco editor / Monaco-GraphQL / JSONC variables/hea…
dimaMachina Jun 4, 2025
ec1f126
Merge branch 'main' into graphiql-5
dimaMachina Jun 4, 2025
b131e9f
Merge branch 'main' into graphiql-5
dimaMachina Jun 4, 2025
e08c217
Update soft-cars-notice.md (#3987)
dimaMachina Jun 4, 2025
17bee1c
[4] Update graphiql examples, add GraphiQL 5 x Vite and GraphiQL 5 x …
dimaMachina Jun 4, 2025
2e8ce1c
ignore react and next.js example in changesets config.json
dimaMachina Jun 4, 2025
0bcd074
Update chilly-sloths-heal.md
dimaMachina Jun 4, 2025
9fc4b21
Version Packages (rc) (#3981)
acao Jun 4, 2025
0993ea4
Merge branch 'main' into graphiql-5
dimaMachina Jun 6, 2025
20edad1
merge conflicts
dimaMachina Jun 6, 2025
82e24fa
Merge branch 'main' into graphiql-5
dimaMachina Jun 6, 2025
2403c68
merge conflicts
dimaMachina Jun 6, 2025
27e7eb6
graphiql 5: allow multiple independant instances on the same page (#3…
dimaMachina Jun 6, 2025
fc8f37b
Update config.json
dimaMachina Jun 6, 2025
a45e8dc
Version Packages (rc) (#3998)
acao Jun 6, 2025
866a8f3
graphiql 5: update graphiql-cdn example to show how to load workers w…
dimaMachina Jun 8, 2025
2d9faec
graphiql 5: remove UMD builds (#4002)
dimaMachina Jun 8, 2025
0c8e390
graphiql 5: remove `readOnly` prop, document `keyMap` prop was remove…
dimaMachina Jun 8, 2025
16fdd6a
upd (#4004)
dimaMachina Jun 8, 2025
1e3ec84
graphiql 5: support `externalFragments` prop and remove `validationRu…
dimaMachina Jun 9, 2025
7792dc9
graphiql 5: push field type on stack too before field (#4006)
dimaMachina Jun 9, 2025
f9780bd
graphiql 5: Use an additional `Alt` key for focus doc explorer search…
dimaMachina Jun 10, 2025
e0dafa4
graphiql 5: add f1 command as first item in shortcut table (#4008)
dimaMachina Jun 10, 2025
8adfaaf
Version Packages (rc) (#4001)
acao Jun 10, 2025
4936492
graphiql 5: separate store actions from state, add `useGraphiQLAction…
dimaMachina Jun 11, 2025
f59eef9
Version Packages (rc) (#4012)
acao Jun 11, 2025
7e8057d
Merge branch 'main' into graphiql-5
dimaMachina Jun 11, 2025
30bc3f9
[graphiql 5] fix: save last opened plugin in storage (#4011)
dimaMachina Jun 11, 2025
6de10b8
Version Packages (rc) (#4013)
acao Jun 13, 2025
4b39f11
graphiql 5: extract storage key constants (#4014)
dimaMachina Jun 13, 2025
c4d3925
Version Packages (rc) (#4015)
acao Jun 14, 2025
cff3da5
graphiql 5: extract graphiql sidebar to react component (#4017)
dimaMachina Jun 15, 2025
d4950df
Version Packages (rc) (#4018)
acao Jun 15, 2025
3c0ad34
graphiql 5: run cypress tests in React strict mode (#4020)
dimaMachina Jun 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/beige-months-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@graphiql/plugin-doc-explorer': minor
'@graphiql/plugin-explorer': major
'@graphiql/plugin-history': minor
'@graphiql/react': minor
'graphiql': major
---

- allow multiple independent instances of GraphiQL on the same page
- store `onClickReference` in query editor in React `ref`
- remove `onClickReference` from variable editor
- fix shortcut text per OS for run query in execute query button's tooltip and in default query
- allow override all default GraphiQL plugins
- adjust operation argument color to be purple from GraphiQL v2 on dark/light theme
26 changes: 26 additions & 0 deletions .changeset/chilly-sloths-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
'@graphiql/plugin-doc-explorer': patch
'@graphiql/plugin-explorer': patch
'@graphiql/plugin-history': patch
'codemirror-graphql': patch
'@graphiql/react': minor
'graphiql': patch
---

- replace `onCopyQuery` hook with `copyQuery` function
- replace `onMergeQuery` hook with `mergeQuery` function
- replace `onPrettifyEditors` hook with `prettifyEditors` function
- remove `fetcher` prop from `SchemaContextProvider` and `schemaStore` and add `fetcher` to `executionStore`
- add `onCopyQuery` and `onPrettifyQuery` props to `EditorContextProvider`
- remove exports (use `GraphiQLProvider`)
- `EditorContextProvider`
- `ExecutionContextProvider`
- `PluginContextProvider`
- `SchemaContextProvider`
- `StorageContextProvider`
- `ExecutionContextType`
- `PluginContextType`
- feat(@graphiql/react): migrate React context to zustand:
- replace `useExecutionContext` with `useExecutionStore` hook
- replace `useEditorContext` with `useEditorStore` hook
- prefer `getComputedStyle` over `window.getComputedStyle`
1 change: 1 addition & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"access": "public",
"baseBranch": "main",
"ignore": [
"example-graphiql-vite",
"example-graphiql-webpack",
"example-monaco-graphql-nextjs",
"example-monaco-graphql-react-vite",
Expand Down
6 changes: 6 additions & 0 deletions .changeset/dull-balloons-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphiql/react': minor
'graphiql': major
---

update graphiql-cdn example to show how to load workers with esm.sh
8 changes: 8 additions & 0 deletions .changeset/eleven-rings-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@graphiql/plugin-doc-explorer': minor
'@graphiql/plugin-explorer': major
'@graphiql/react': minor
'graphiql': major
---

separate store actions from state, add `useGraphiQLActions` state
5 changes: 5 additions & 0 deletions .changeset/fluffy-beers-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/plugin-doc-explorer': patch
---

push field type on stack too before field
5 changes: 5 additions & 0 deletions .changeset/four-carrots-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/plugin-doc-explorer': patch
---

Use an additional `Alt` key for focus doc explorer search input instead of `Cmd/Ctrl+K` because monaco-editor has a built-in shortcut for `Cmd/Ctrl+K`
7 changes: 7 additions & 0 deletions .changeset/good-turtles-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphiql/plugin-code-exporter': major
'@graphiql/plugin-explorer': major
'graphiql': major
---

remove UMD builds
7 changes: 7 additions & 0 deletions .changeset/gorgeous-lobsters-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphiql/react': patch
---

- run cypress tests in React strict mode
- fix `defaultQuery` with empty string does not result in an empty default query
- fix `useDidUpdate` in React strict mode
11 changes: 11 additions & 0 deletions .changeset/honest-clouds-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'monaco-graphql': patch
---

remove unused types

- `BaseSchemaConfig`
- `IDisposable`
- `JSONDiagnosticOptions`
- `IEvent`
- `FilePointer`
6 changes: 6 additions & 0 deletions .changeset/kind-timers-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphiql/react': minor
'graphiql': major
---

support `externalFragments` prop and remove `validationRules` prop
7 changes: 7 additions & 0 deletions .changeset/many-ducks-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphiql/react': minor
'graphiql': major
---

remove `readOnly` prop
document `keyMap` prop was removed in migration guide
7 changes: 7 additions & 0 deletions .changeset/nasty-pandas-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'graphiql': major
---

Remove examples: `GraphiQL x Parcel` and `GraphiQL x Create React App`

Add new examples: `GraphiQL x Vite` and `GraphiQL x Next.js`
6 changes: 6 additions & 0 deletions .changeset/orange-spies-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphiql/react': minor
'graphiql': minor
---

extract graphiql sidebar to react component
48 changes: 48 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"mode": "pre",
"tag": "rc",
"initialVersions": {
"example-graphiql-webpack": "0.0.0",
"example-monaco-graphql-nextjs": "0.0.0",
"example-monaco-graphql-react-vite": "0.0.0",
"example-monaco-graphql-webpack": "0.0.0",
"cm6-graphql": "0.2.1",
"codemirror-graphql": "2.2.1",
"graphiql": "4.1.1",
"@graphiql/plugin-code-exporter": "4.0.5",
"@graphiql/plugin-doc-explorer": "0.2.2",
"@graphiql/plugin-explorer": "4.0.6",
"@graphiql/plugin-history": "0.2.2",
"@graphiql/react": "0.34.1",
"@graphiql/toolkit": "0.11.3",
"graphql-language-service": "5.3.1",
"graphql-language-service-cli": "3.5.0",
"graphql-language-service-server": "2.14.8",
"monaco-graphql": "1.6.1",
"vscode-graphql": "0.13.2",
"vscode-graphql-execution": "0.3.2",
"vscode-graphql-syntax": "1.3.8",
"example-graphiql-nextjs": "0.0.0",
"example-graphiql-vite": "0.0.0"
},
"changesets": [
"beige-months-care",
"chilly-sloths-heal",
"dull-balloons-warn",
"eleven-rings-complain",
"fluffy-beers-build",
"four-carrots-leave",
"good-turtles-speak",
"honest-clouds-brush",
"kind-timers-exist",
"many-ducks-visit",
"nasty-pandas-taste",
"orange-spies-poke",
"shy-keys-rest",
"soft-cars-notice",
"sweet-lamps-love",
"ten-peas-carry",
"twelve-lies-invent",
"warm-shoes-boil"
]
}
5 changes: 5 additions & 0 deletions .changeset/shy-keys-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/plugin-doc-explorer': patch
---

show spinner in doc explorer based on `isIntrospecting` value, and not based on `isFetching`
14 changes: 14 additions & 0 deletions .changeset/soft-cars-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@graphiql/plugin-code-exporter': patch
'@graphiql/plugin-doc-explorer': minor
'@graphiql/plugin-explorer': patch
'@graphiql/plugin-history': patch
'@graphiql/react': minor
'graphiql': major
---

Migration from Codemirror to [Monaco Editor](https://github.com/microsoft/monaco-editor)

Replacing `codemirror-graphql` with [`monaco-graphql`](https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql)

Support for comments in **Variables** and **Headers** editors
8 changes: 8 additions & 0 deletions .changeset/sweet-lamps-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@graphiql/plugin-history': minor
'@graphiql/react': minor
---

fix execute query shortcut in query editor, run it even there are no operations in query editor

fix plugin store, save last opened plugin in storage
5 changes: 5 additions & 0 deletions .changeset/ten-peas-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/react': minor
---

extract storage key constants
6 changes: 6 additions & 0 deletions .changeset/twelve-lies-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'graphiql': patch
---

- add f1 command as first item in shortcut table
- set color of `quickInputList.focusForeground` in command palette to be primary color
16 changes: 16 additions & 0 deletions .changeset/warm-shoes-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@graphiql/react': minor
'@graphiql/plugin-history': minor
'@graphiql/plugin-doc-explorer': minor
'graphiql': patch
---

- remove `useQueryEditor`, `useVariableEditor`, `useHeaderEditor`, `useResponseEditor` hooks
- remove `UseHeaderEditorArgs`, `UseQueryEditorArgs`, `UseResponseEditorArgs`, `UseVariableEditorArgs` exports
- rename components
- `StorageContextProvider` => `StorageStore`
- `EditorContextProvider` => `EditorStore`
- `SchemaContextProvider` => `SchemaStore`
- `ExecutionContextProvider` => `ExecutionStore`
- `HistoryContextProvider` => `HistoryStore`
- `ExplorerContextProvider` => `ExplorerStore`
29 changes: 25 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ module.exports = {
'functions/*',
'packages/vscode-graphql-syntax/tests/__fixtures__/*',
// symlinks
'packages/graphiql-react/__mocks__/monaco-editor.ts',
'packages/graphiql-plugin-doc-explorer/__mocks__/zustand.ts',
'packages/graphiql-plugin-doc-explorer/__mocks__/monaco-editor.ts',
'packages/graphiql-plugin-history/__mocks__/zustand.ts',
'packages/graphiql-plugin-history/__mocks__/monaco-editor.ts',
],
overrides: [
{
Expand Down Expand Up @@ -142,6 +145,15 @@ module.exports = {
property: 'navigator',
message: 'Use `navigator` instead',
},
{
object: 'window',
property: 'getComputedStyle',
message: 'Use `getComputedStyle` instead',
},
{
object: 'self',
message: 'Use `globalThis` instead',
},
],
'no-return-assign': 'error',
'no-return-await': 'error',
Expand Down Expand Up @@ -171,7 +183,7 @@ module.exports = {
'init-declarations': 'off',
'no-catch-shadow': 'error',
'no-label-var': 'error',
'no-restricted-globals': 'off',
'no-restricted-globals': ['error', 'stop'],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'no-undef-init': 'off',
Expand Down Expand Up @@ -362,6 +374,7 @@ module.exports = {
'unicorn/no-length-as-slice-end': 'error',
'unicorn/prefer-string-replace-all': 'error',
'unicorn/prefer-array-some': 'error',
// '@typescript-eslint/prefer-for-of': 'error', TODO
'unicorn/no-hex-escape': 'off', // TODO: enable
// doesn't catch a lot of cases; we use ESLint builtin `no-restricted-syntax` to forbid `.keyCode`
'unicorn/prefer-keyboard-event-key': 'off',
Expand All @@ -374,6 +387,13 @@ module.exports = {
'import-x/no-named-as-default-member': 'off',
},
},
{
files: ['packages/{monaco-graphql,graphiql*}/**/*.{ts,tsx,mts,cts}'],
excludedFiles: ['packages/graphiql-toolkit/**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-unnecessary-condition': 'error',
},
},
{
// Rules that requires type information
files: ['**/*.{ts,tsx,mts,cts}'],
Expand All @@ -388,6 +408,7 @@ module.exports = {
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/no-duplicate-type-constituents': 'error',
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
// '@typescript-eslint/await-thenable': 'error', // TODO
// TODO: Fix all errors for the following rules included in recommended config
'@typescript-eslint/no-deprecated': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
Expand All @@ -404,11 +425,10 @@ module.exports = {
projectService: {
allowDefaultProject: [
'examples/monaco-graphql-react-vite/vite.config.ts',
'packages/graphiql/vite.config.mts',
'packages/{codemirror-graphql,graphiql-toolkit,graphql-language-service-cli,graphql-language-service,monaco-graphql,vscode-graphql-syntax,graphiql}/vitest.config.mts',
'packages/{codemirror-graphql,graphiql-toolkit,graphql-language-service-cli,graphql-language-service,monaco-graphql,vscode-graphql-syntax}/vitest.config.mts',

'packages/cm6-graphql/__tests__/test.spec.ts',
'packages/graphiql/src/GraphiQL.spec.tsx',
'packages/graphiql/cypress.config.ts',
'packages/vscode-graphql-syntax/tests/*.spec.ts',
'packages/graphql-language-service-cli/src/__tests__/*.test.ts',
'packages/monaco-graphql/test/monaco-editor.test.ts',
Expand Down Expand Up @@ -565,6 +585,7 @@ module.exports = {
'react-hooks/rules-of-hooks': 'off',
'sonarjs/no-dead-store': 'off',
'@typescript-eslint/no-restricted-imports': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release

on:
push:
branches: [main]
branches: [main, graphiql-5]
permissions: {}
jobs:
release:
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ packages/codemirror-graphql/*.d.ts
packages/codemirror-graphql/*.map
!packages/codemirror-graphql/*.config.js

packages/graphiql/graphiql*.js
packages/graphiql/*.css
packages/graphiql/*.map
packages/graphiql/cypress/screenshots/
packages/graphiql/cypress/downloads/
packages/graphiql/typedoc/
packages/graphiql/webpack/

packages/graphiql/cypress/downloads/
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"**/esbuild.js",
".eslintrc.js",
".vscode/extensions.json",
"packages/monaco-graphql/test/monaco-editor.test.ts",
"working-group"
],
"files": ["**/*.{js,cjs,mjs,ts,jsx,tsx,md,mdx,html,json,css,toml,yaml,yml}"]
Expand Down
5 changes: 5 additions & 0 deletions docs/migration/graphiql-5.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
- Added new examples: [**GraphiQL x Vite**](https://github.com/graphql/graphiql/tree/graphiql-5/examples/graphiql-vite) and [**GraphiQL x
Next.js**](https://github.com/graphql/graphiql/tree/graphiql-5/examples/graphiql-nextjs)
- Removed examples: **GraphiQL x Parcel** and **GraphiQL x Create React App**
- UMD build is removed. Use the ESM-based CDN instead.
- Removed props
- `keyMap`. To use Vim or Emacs keybindings in Monaco, you can use community plugins. Monaco Vim: https://github.com/brijeshb42/monaco-vim. Monaco Emacs: https://github.com/aioutecism/monaco-emacs
- `readOnly`
- `validationRules`. Use custom GraphQL worker, see https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql#custom-webworker-for-passing-non-static-config-to-worker.'
Loading
Loading