Skip to content
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

[Graphiql Explorer Plugin] (Next.js) Cursor/Caret jumps when editing query manually #2859

Open
2 of 4 tasks
crjm opened this issue Nov 3, 2022 · 21 comments · Fixed by #3330
Open
2 of 4 tasks

[Graphiql Explorer Plugin] (Next.js) Cursor/Caret jumps when editing query manually #2859

crjm opened this issue Nov 3, 2022 · 21 comments · Fixed by #3330
Assignees

Comments

@crjm
Copy link

crjm commented Nov 3, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When editing the query by hand when using the GraphiQL component together with the explorerPlugin passed in the props array, the cursor resets, and appears in the first line of the editor.
I'm currently implementing the plugin as stated in the README

Expected Behavior

The caret shouldn't jump to the beginning.

Steps To Reproduce

1. Clone https://github.com/crjm/graphiql-explorer-test
2. cd into cloned repo, `npm install`
3. `npm run dev`
4. Open Explorer plugin, trigger fields
5. Start typing directly into the editor
6. The caret will jump to the first line of the editor.

Module pattern

  • graphiql-umd
  • graphiql-esm
  • graphiql-commonjs

Environment

- GraphiQL Version: latest
- OS: Ubuntu 22.04
- Browser: Firefox
- Bundler: Next.js (Webpack 5)
- `react` Version: 18.2
- `graphql` Version: 15.8

Anything else?

No response

@jonathanawesome
Copy link
Collaborator

I can't replicate this in your repository or with StackBlitz. Are you able to take a screen capture to share?

@crjm crjm changed the title [Graphiql Explorer Plugin] Cursor/Caret jumps when editing query manually [Graphiql Explorer Plugin] (Next.js) Cursor/Caret jumps when editing query manually Nov 3, 2022
@marcosnils
Copy link

marcosnils commented Nov 3, 2022

I can't replicate this in your repository or with StackBlitz. Are you able to take a screen capture to share?

👋 seems to happen in StackBlitz as well. Recording below using Mozilla Firefox 106.0.4.

This doesn't happen when using plain react. Maybe it's realted to Next SSR nature and the fact that dynamic is being used here to force client-side rendering? https://github.com/crjm/graphiql-explorer-test/blob/main/pages/index.js#L6

recording.mp4

@marcosnils
Copy link

@jonathanawesome just checking if you were able to reproduce 🙏

@jonathanawesome
Copy link
Collaborator

jonathanawesome commented Nov 7, 2022

Yep, thanks...I see it now and you're probably right that it's related to the dynamic import.

I can get it to jump without interacting with the Explorer plugin, so that's not the issue.

Curious that we haven't had this reported before, I wonder if it has something to do with next 13.

Have you tried downgrading to next 12?

Have you tried with babel rather than with swc?

@marcosnils
Copy link

Thx for the quick reply Jonathan. It also happens in next 12. Regarding babel, we haven't tried that yet.

We'll keep doing some more tests

@jonathanawesome
Copy link
Collaborator

jonathanawesome commented Nov 8, 2022

Here's a related conversation with a workaround.

@marcosnils
Copy link

Here's a related conversation with a workaround.

In our case we're using NextJS dynamic imports with without SSR capabilities as described here: https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr. If my understanding is correct, it should be the same as the outcomes you've shared. This issue happens only when adding the explorer plugin, so I assume there must be something happening around how both libs are being bundled and initialized in the client-side when using Next.

@bkuzma
Copy link

bkuzma commented Nov 21, 2022

I'm experiencing the cursor jump as well and I'm using neither NextJS nor SSR 😕 I am using the explorer plugin, though I saw the problem occur when I disabled it. One thing I think I noticed: when I removed the explorer plugin along with the code that keeps the user-typed query in state (this is needed for the explorer plugin, see https://github.com/OneGraph/graphiql-explorer-example/blob/master/src/App.js#L88) and sets that query as a prop on the GraphiQL instance, I couldn't reproduce the problem.

  • GraphiQL Version: 2.0.9
  • OS: Mac OS Ventura
  • Browser: Chrome
  • Bundler: Babel
  • react Version: 18.2.0
  • graphql Version: 16.6.0

@acao acao self-assigned this Nov 21, 2022
@davegariepy
Copy link

davegariepy commented Dec 11, 2022

seems like useState is not keeping up
turning off onEditQuery seems to stop the cursor jump
unfortunately this causes the explorer plugin checkboxes to not match subsequent manual edits in the editor, a somewhat less annoying bug

<GraphiQL
      fetcher={fetcher}
      query={query}
      // onEditQuery={setQuery}
      plugins={[explorerPlugin]}
    />

@rrva
Copy link

rrva commented Dec 23, 2022

We applied the following workaround, but it does not prevent the the cursor jumps completely, it only makes them happen less often. Is this bug being worked on? It is pretty annoying.

diff --git a/src/App.tsx b/src/App.tsx
index a0658c1..68553a7 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {useEffect} from 'react';
 import GraphiQL from 'graphiql';
 import 'graphiql/graphiql.css';
 import '@graphiql/plugin-explorer/dist/style.css';
@@ -105,8 +105,14 @@ const App = () => {
         return api != null ? api.url.substring(0, api.url.lastIndexOf("/")) : "";
     }
 
+    const [isClientRendering, setIsClientRendering] = useState(false);
+    useEffect(() => {
+        setIsClientRendering(true);
+    }, []);
+
     return (
         <>
+            {isClientRendering ?
             <GraphiQL fetcher={fetcher} query={query} onEditQuery={updateQuery} plugins={[explorerPlugin]} toolbar={{
                 additionalContent: (
                     <>
@@ -165,6 +171,7 @@ const App = () => {
                 ),
             }}>
             </GraphiQL>
+                : null}
             {showComparer && (
                 <Comparer
                     query={query}

@jonathanawesome
Copy link
Collaborator

We applied the following workaround, but it does not prevent the the cursor jumps completely, it only makes them happen less often. Is this bug being worked on? It is pretty annoying.

I'm not currently working on this (and my assumption is that no one else is, either), nor do I plan to. The OneGraph Explorer plugin that's in this repository is a legacy placeholder that is meant to hold folks over until we've had the time to design and develop the new "core" plugin with similar functionality (see here).

That said, this is open source software. If any one out there that is deeply impacted by this issue would like to take the time to come up with a working solution, we'd be happy to review and merge.

@rrva
Copy link

rrva commented Dec 30, 2022

We applied the following workaround, but it does not prevent the the cursor jumps completely, it only makes them happen less often. Is this bug being worked on? It is pretty annoying.

I'm not currently working on this (and my assumption is that no one else is, either), nor do I plan to. The OneGraph Explorer plugin that's in this repository is a legacy placeholder that is meant to hold folks over until we've had the time to design and develop the new "core" plugin with similar functionality (see here).

That said, this is open source software. If any one out there that is deeply impacted by this issue would like to take the time to come up with a working solution, we'd be happy to review and merge.

Thanks, good to know. We will consider if we stop using explorer for a while, or at least offer a version without it.

@rrva
Copy link

rrva commented Dec 30, 2022

@jonathanawesome I know little react, do you think the bug is that useState triggers unwanted re-renders? Which of these do you think is worth trying?

Rewrite the solution using:

  1. useEditorContext
  2. useRef
  3. memo

@acao
Copy link
Member

acao commented Jul 10, 2023

Does the issue seem to be fixed here?

I've decided to start deploying our graphiql + webpack w/ plugins example again so we can make these issues more easily reproducible

https://deploy-preview-3328--graphiql-test.netlify.app/webpack/

@marcosnils
Copy link

https://deploy-preview-3328--graphiql-test.netlify.app/webpack/

just tested in this URL and seems to be fixed here indeed.

@acao
Copy link
Member

acao commented Jul 10, 2023

awesome to hear @marcosnils , thanks for checking it out for me. I will merge as #3330 as 0.3.0 releases of the plugins. it will cause breaking changes to the plugin implementations that will simplify plugin usage

@acao
Copy link
Member

acao commented Jul 10, 2023

@marcosnils here is a version to test in your implementation, can you confirm it works in your implementation?

canary fix version:

please follow these instructions to update your implementation with the new plugin signature.

@rrva @bkuzma @crjm try this fix version if/when you can!

acao added a commit that referenced this issue Jul 11, 2023
#3330)

- simplify plugin development
- simplify plugin implementation
- fix #2859 cursor jumping issue
- drop the `use` prefix, because they should not be invoked as react hooks, but widely used eslint rules will assume they are hooks
- update examples for 0.2.0 breaking change
- consistent naming
  - `@graphiql/plugin-code-exporter` -> exports `codeExporterPlugin()` module
  - `@graphiql/plugin-explorer` ->  exports `explorerPlugin()` module
@acao
Copy link
Member

acao commented Jul 11, 2023

this fix has been released as 0.3.0!

please note the changelog again, one slight naming convention tweak to code exporter plugin while we were making a breaking change.

if you are using the module from npm, the changelog instructions will help you, and the READMEs have been updated.

if you are using the CDN bundle path, follow the updated example for explorer plugin and/or for code exporter plugin

@rrva
Copy link

rrva commented Jul 11, 2023

Awesome @acao

Have not tested yet, but this is a big one for us. It prevented explorer usage so we were stuck with using both v1 and v2 in parallel. v1 had explorer, v2 can send auth headers. Looking forward to use v2 for all use cases

@acao
Copy link
Member

acao commented Jul 11, 2023

@rrva oh dear, yes we added the headers tab in graphiql@1.2 or so I believe, but you should be able to use the latest 2.x and the @graphiql/plugin-explorer@0.3.0 together without this bug now! let us know if there are still issues in your implementation and we can re-open, but this seemed to resolve the issue for several people using either the module or UMD builds

JohnAdamsy added a commit to JohnAdamsy/graphiql that referenced this issue Jul 12, 2023
* Fix react testling library context errors (graphql#2903)

* upgrades testing-library packages to latest allowed @ React 17
* updates @graphiql/react test files for new testing-library version
* updates tests to remove act() warnings
• rewrites some tests to remove old prop values and use new ones

* fix autocomplete popover styles (graphql#2910)

* fix styles of secondary editor buttons (graphql#2911)

* add missing effect dep for default headers (graphql#2912)

* show multipart requests as running until they are finished or cancelled (graphql#2907)

* show multipart requests as running until they are finished or cancelled

* Improve changeset wording

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* fix grammar

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* fix grammar

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* rename the `initialTabs` prop to `defaultTabs` (graphql#2908)

* rename the `initialTabs` prop to `defaultTabs`

* also bump graphiql package

* improve prop description

* chore(deps): bump loader-utils from 1.4.0 to 1.4.2 (graphql#2914)

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](webpack/loader-utils@v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix tabbar overflow (graphql#2919)

* fix: prevent default event for graphiql-doc-explorer-back link (graphql#2905)

* fix: prevent default event for graphiql-doc-explorer-back link

* changeset and formatting

* Version Packages (graphql#2902)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix(sonar-lint): 🐛 fixed doctype and missing html tags (graphql#2835)

* fix(sonar-lint): 🐛 fixed doctype and missing html tags

* Some HTML housekeeping

* unaltered settings

* refactor: 🔒 Added subresource integrity to unpkg cdn links

* Update examples/graphiql-cdn/index.html

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

* Update packages/graphiql/resources/index.html.ejs

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

* fix: support cts/mts extensions (graphql#2926)

Resolves graphql#2855

* Remove side-effect in StorageAPI that overrides localStorage.clear (graphql#2923)

* remove `mapCat()` in favor of `Array#flatMap()`

* enable `no-negated-condition` and `no-else-return` rules (graphql#2931)

* enable `promise/no-multiple-resolved` (graphql#2943)

* enable `sonarjs/no-redundant-jump` rule

* removes regenerator-runtime from cdn.ts (graphql#2939)

* fix workspaces bug on merge (graphql#2953)

* fix changelog formatting issue hopefully (graphql#2957)

* [@graphiql/react]: replace `compose.ts` with `clsx` for class concatenation (graphql#2932)

* check interpolation

* add changeset

* ignore clsx word

* enable `unicorn/throw-new-error` rule (graphql#2938)

* enable `unicorn/prefer-logical-operator-over-ternary` rule (graphql#2941)

* Improved grammar & punctuation in DEVELOPMENT.md (graphql#2927)

* Improved grammar & punctuation in DEVELOPMENT.md

* Update DEVELOPMENT.md

missed a bit

* fix wording and linting

Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>

* chore(deps-dev): bump express from 4.17.1 to 4.17.3 (graphql#2960)

Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.17.3.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.17.1...4.17.3)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* enable `unicorn/prefer-includes` (graphql#2937)

* enable `unicorn/prefer-includes`

* fix build

* chore(deps): bump qs from 6.5.2 to 6.5.3 (graphql#2959)

Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](ljharb/qs@v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* enable `@typescript-eslint/no-unused-expressions` rule (graphql#2933)

* enable `lonely-if`/`unicorn/lonely-if` rules (graphql#2936)

* enable `lonely-if`/`unicorn/lonely-if`

* do yarn

* extends `plugin:import/recommended` and fix warnings (graphql#2922)

* extends `plugin:import/recommended` and fix warnings

* fix lint in ci

* fix unit tests

* fix e2e

* remove `wonka`/`regenerator-runtime` from dependencies
remove `regenerator-runtime/runtime` import

* remove examples from workspaces

* rebase and enable merged rules

* update examples

* rebase fixes

* Update config.json (graphql#2961)

* avoid literal asterisks, use underscores instead (graphql#2969)

* chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (graphql#2934)

Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* complete (graphql#2972)

* Add Jan 2023 WG agenda (graphql#2988)

* Add user facing setting for persisting headers (graphql#2895)

* feat: Add user facing setting for persisting headers

* Only allow controlling setting if prop value is true/undefined

* Clean up tab storage headers when persising headers turns off

* add warning message

* fix initial value

* restore tabs store if toggling on

* version changes as "minor"

* Simplify logic to show persisting headers settings

* sync persist header prop if it changes

* chore(deps): bump json5 from 1.0.1 to 1.0.2 (graphql#2987)

Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* enable `sonarjs/no-small-switch` and `sonarjs/no-duplicated-branches` rules (graphql#2966)

* enable `unicorn/prefer-export-from` rule (graphql#2964)

* enable `unicorn/prefer-optional-catch-binding` rule (graphql#2965)

* Fix graphiql react issue with setting tabs title (graphql#2968)

* updates fuzzyExtractOperationName regex

* adds/rearranges tests for "comment line handling"

* enable `prefer-destructuring` rule (graphql#2963)

* enable `prefer-destructuring` rule

* fixes

* fix netlify build (cm6 project references fix) (graphql#2992)

* Version Packages (graphql#2928)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: avoid infinity recursiveness in getVariablesJSONSchema (graphql#2917)

* fix: avoid infinity recursiveness in getVariablesJSONSchema

add a marker to mark analyzed InputObject to avoid infinity recursiveness while generating JsonSchema.
set $ref field for definition while recursion is found
put marker into options to avoid extra parameters
add test unit for this bug

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* fix(cm6-graphql): Fix query token used as field name (graphql#2995)

* fix(cm6-graphql): Fix query token used as field name

Use @extend instead of @Specialize
Fixed tests

* Create eighty-spiders-crash.md

* build cm6-graphql

* fix build

* addressed pr feedback

* yarn format

* fix: VariableJSONSchema for custom scalars (graphql#2986)

* 🛠️ ESLint: add `unicorn/consistent-destructuring` rule (graphql#2993)

* add `unicorn/consistent-destructuring` rule

* Fix highlighting for GraphQL errors with multiple nodes (graphql#2913)

* fix eslint error (graphql#3008)

* Fix typo (`/* GraphiQL */` => `/* GraphQL */`) (graphql#3006)

* docs: fix typo

* docs: yarn pretty

* Update README (graphql#3004)

* Remove LGTM grade

https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/

* Remove server from `graphql-language-service-server-cli`

* chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (graphql#3014)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump ua-parser-js from 1.0.2 to 1.0.33 (graphql#3003)

Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 1.0.2 to 1.0.33.
- [Release notes](https://github.com/faisalman/ua-parser-js/releases)
- [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md)
- [Commits](faisalman/ua-parser-js@1.0.2...1.0.33)

---
updated-dependencies:
- dependency-name: ua-parser-js
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 🛠️ ESLint: enable `unicorn/prefer-node-protocol` rule (graphql#2940)

* enable `unicorn/prefer-node-protocol` rule

* use `"@types/node": "^16.18.4"` since github ci is use node v16

* fix unit tests

* fix

* rebase

* 🛠️ ESLint: clean all ESLint warnings, add `--max-warnings=0` and `--cache` flags (graphql#2962)

* clean all ESLint warnings, add `--max-warnings=0` and `--cache` flags

* format

* rebase

* extends `plugin:@typescript-eslint/recommended` (graphql#2967)

* Add Feb 2023 agenda (graphql#3023)

* update `canuise-lite` (graphql#3018)

* feat: maintain DocExplorer stack on schema update

* feature: add fragment arguments syntax highlights (graphql#3019)

* update cypress to v12.6.0 (graphql#2893)

* update cypress to v11.0.1

* fix lint

* upgrade to webpack 5, re-add monaco workspace

* simplify monaco webpack example

* enable `sonarjs/no-identical-functions`, `sonarjs/no-unused-collection`, `sonarjs/no-extra-arguments` rules (graphql#3038)

* [ESLint] enable `logical-assignment-operators` rule (graphql#3036)

* enable `logical-assignment-operators` rule

* Update GraphQLCache.ts

* format

* lint renderExample.js, cleanup .eslintignore file (graphql#3034)

* extend `plugin:cypress/recommended` config (graphql#3035)

* enable `unicorn/prefer-switch` rule (graphql#3051)

* add an example with next.js and monaco-graphql (graphql#3040)

* finish upgrading webpack & babel dependencies, fix monaco example (graphql#3053)

* a few more tweaks for clean builds on the monaco-graphql-webpack example. 
* reintroduce the monaco example reference workspace, make this a testbed for monaco-graphql development again
* consolidate more babel versions
* upgrade the rest of the webpack & babel ecosystem

* enable `unicorn/no-useless-switch-case` rule (graphql#3049)

* remove nested eslint configs (graphql#3052)

* Version Packages (graphql#3001)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix monaco peer deps and linting (graphql#3071)

* format changes on changesets version before publish (graphql#3073)

* fix: add graphql-language-service as direct dep to cm6-graphql (graphql#3069)



Co-authored-by: Samuel <samuelimolo4real@gmail.com>

* Format on version (graphql#3074)

* try a simpler command to make changesets action happy
* changesets should ignore example-*

* do not suggest `ReactDOM.render(..., document.body)` as it's anti pattern! (graphql#3064)

* fix `vscode-graphql-syntax` readme (graphql#3062)

* enable `unicorn/no-zero-fractions` rule (graphql#3048)

* [ESLint] enable `unicorn/prefer-array-flat-map` rule (graphql#3044)

* enable `unicorn/prefer-array-flat-map` rule

* format

* remove unneeded `reference &&` assertion, convert to switch (graphql#3061)

* enable `unicorn/prefer-string-replace-all` rule (graphql#3043)

* [ESLint] Prefer String#slice() over String#substr() and String#substring() (graphql#3042)

* Prefer String#slice() over String#substr() and String#substring()

* fix tests

* format

* enable `unicorn/prefer-regexp-test` rule (graphql#3045)

* remove redundant `catch` statement (graphql#3033)

* build before lint after version

* [ESLint] enable `unicorn/prefer-at` rule (graphql#3046)

* format

* fixes

* enable `unicorn/prefer-switch` rule (graphql#3050)

* avoid `useMemo` with empty array `[]` since React can't guarantee stable reference, + lint restrict syntax for future mistakes (graphql#3063)

* avoid `useMemo` with empty array `[]` since React can't guarantee stable reference, + lint restrict syntax for future mistakes

* fix migration

* prettify

* fix new build issue (graphql#3078)

* chore(deps): bump undici from 5.10.0 to 5.20.0 (graphql#3027)

Bumps [undici](https://github.com/nodejs/undici) from 5.10.0 to 5.20.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v5.10.0...v5.20.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* use writeFile from `fs/promises` instead `promisify(writeFile)` (graphql#3082)

* use writeFile from fs/promises instead `promisify(writeFile)`

* Delete little-zebras-fry.md

* remove unneeded check for `schema` (graphql#3083)

* remove unneeded check for `schema`

* Delete sweet-dolphins-breathe.md

* refactor `classList.remove` since he accept multiple argument (graphql#3092)

* remove `null` from `ReactNode | null` union (because `null` already value of `ReactNode`) (graphql#3090)

* use promise version of fs.readFile (graphql#3084)

* chore(deps-dev): bump webpack from 5.75.0 to 5.76.0 (graphql#3099)

Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.75.0...v5.76.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* monaco example fixes, fix missing worker bug (graphql#3093)

* monaco example fixes, fix missing worker bug

* avoid bundling code from `react/jsx-runtime` (graphql#3017)

* mark `react/jsx-runtime` as external in `@graphiql/react`
 use classic jsx transform in plugins

* do not destructure `Kind` from graphql (graphql#3085)

* remove nowhere used `entities` dependency (graphql#3087)

* [ESLint] enable `@typescript-eslint/no-unnecessary-type-assertion` (graphql#3086)

* setup rule

* fixes

* prettier

* fixes

* prettier

* fixes

* prettier

* fixes

* prettier

* fixes

* fixes

* set `NODE_OPTIONS=--max-old-space-size=3500`

* set `NODE_OPTIONS=--max-old-space-size=4096`

* add vscode-graphql to the readme (graphql#3104)

vscode-graphql was never added to the root readme!

* [MessageProcessor] move some class field declaration outside of constructor (graphql#3089)

* enable `unicorn/no-array-push-push` rule (graphql#3047)

* chore(deps): bump @sideway/formula from 3.0.0 to 3.0.1 (graphql#3102)

Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/sideway/formula/releases)
- [Commits](hapijs/formula@v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: "@sideway/formula"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump webpack in /examples/monaco-graphql-nextjs (graphql#3101)

Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.75.0...v5.76.2)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update package.json, set NODE_OPTIONS=--max-old-space-size=4096for eslint (graphql#3105)

* Update package.json

* Update pr-check.yml

* remove nowhere used `node-fetch` dependency

* Version Packages

* [ESLint] enable `unicorn/no-typeof-undefined` rule (graphql#3037)

* fix: build on release

* fix: Webpack dev server config before and after middleware and renderExample path (graphql#3110)

* use netlify.toml again (graphql#3131)

* Updated cm6-graphql package README (graphql#3127)



---------

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* feat: add syntax highlighting in Scala (graphql#3106)

* fix: tweak to prevent prettier formatting to the changelog file (graphql#3133)

* [ESLint] replace `.forEach` with `for..of` (graphql#3113)

* [ESLint] enable `@typescript-eslint/no-floating-promises`, update typescript-eslint to v6 (graphql#3109)

* [ESLint] enable `unicorn/prefer-dom-node-remove` (graphql#3122)

* [ESLint] enable `sonarjs/no-ignored-return` (graphql#3119)

* [ESLint] enable `unicorn/prefer-dom-node-append` (graphql#3117)

* [ESLint] enable `unicorn/no-useless-undefined` (graphql#3121)

* [ESLint] enable `no-var` rule (graphql#3041)

* [ESLint] enable `promise/prefer-await-to-then` for non React packages (graphql#3120)

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* [ESLint] Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode` (graphql#3126)

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* Update globals.css, remove duplicate css prop (graphql#3141)

* fix: vue & svelte wo script tag (graphql#3157)

* fix: vue and svelte files doesn't log error when parsing with no script tag (graphql#2836)

* tweak LSP/vscode changelog entry (graphql#3159)

just adding `vscode-graphql` to the changeset so that users see that this terrible bug has been patched1

* Version Packages

* GraphQLCache: fix multiple projects in one graphqlrc

* Version Packages

* fix(graphql-language-service-server): allow getDefinition to work for unions

* Create many-sloths-shop.md

* refactor: Use isTypeDefinitionNode rather than maintaining list directly

* fix(graphql-language-service-server): apply fix to cross-file definitions

* Update .changeset/many-sloths-shop.md

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* Fix changeset formatting (graphql#3162)

* Version Packages

* Fix GraphQLCache to read both documents and schema

* Version Packages

* feat: Use native LSP logger (graphql#3148)

* feat: add all schema types in classic schema documentation (graphql#3077)

* fix: script offset if vue-sfc contains template above (graphql#3135)


Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>

* fix canary releases (graphql#3172)

canary releases should happen even with `paths-ignore` according to the actions documentation

* adds meeting info and agenda stubs for remaining months of 2023

* Version Packages

* Update README.md (graphql#3174)

Tweaks that weren't picked up in https://github.com/graphql/graphiql/pull/3127/files

* fix duplicated vite config (graphql#3180)

* fix duplicated vite config

* add changeset

* Update .gitignore

---------

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* fix: limit all codemirror css rules to .graphiql-container (graphql#3147)

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* Version Packages (graphql#3190)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* add `package-lock.json` to `.gitignore` (graphql#3142)

* ensure code blocks in Markdown don't contain syntax errors + lint code blocks (graphql#3137)

* enable `@typescript-eslint/non-nullable-type-assertion-style` (graphql#3193)

* avoid unnecessary rerenders React components (graphql#3124)

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>

* [ESLint] Prefer `.textContent` over `.innerText` (graphql#3118)

* replace rest of `event.keyCode` usages by `event.code` (graphql#3136)

* [ESLint] enable `sonar/prefer-promise-shorthand` and `sonar/no-dead-store` rules (graphql#3143)

* fix: fix tab content getting replaced on changeTab (graphql#3194)

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* replaces unneeded backticks with single quotes + lint them! (graphql#3196)

* remove confusing ligatures, set `font-variant-ligatures: none` (graphql#3197)

* Version Packages (graphql#3195)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix ReferenceError: window is not defined in Next.js (graphql#3198)

* Version Packages (graphql#3199)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: make tooltips work when Graphiql is not full page and window has scrolled (graphql#3203)

* 1️⃣ replace `@reach/dialog` by `@radix-ui/react-dialog` and `@reach/visually-hidden` by `@radix-ui/react-visually-hidden` (graphql#3181)

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: Myles Murphy <53157254+mylesmmurphy@users.noreply.github.com>

* Update pre.json (graphql#3208)

* Version Packages (alpha) (graphql#3205)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* renames file and updates copy (graphql#3218)

* fix: Hover docs were offset one position (graphql#3149)

* chore(deps-dev): bump vite from 2.9.13 to 2.9.16 (graphql#3215)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix livedemo link Update README.md (graphql#3222)

* use VSCE_PAT only (graphql#3223)

this is more descriptive, prevents confusion because PAT_TOKEN could refer to anything

* try removing some packages from pre.json (graphql#3224)

* try removing some packages from pre.json

I think we tried this before, but let's see what happens?

* add changeset to trigger canary pipeline

* add note about graphiql dev URL (graphql#3226)

* fix broken graphql.org links Update README.md (graphql#3227)

* enable `@typescript-eslint/consistent-type-assertions` (graphql#3232)

* remove root's package.json `@types/react` and `@types/react-dom` (graphql#3233)

* [@graphiql/react]: exclude peer dependencies and dependencies from bundle (graphql#3228)

* [plugin-code-exporter/plugin-explorer]: exclude peer dependencies and dependencies from bundle (graphql#3229)

* remove storybook references (graphql#3239)

* fix: make `@types/codemirror` a dependency of `@graphiql/react` (graphql#2716)

Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* add cm6-graphql to the readme (graphql#3240)

* add cm6-graphql to the readme

provide waypoints for cm5 vs cm6 users

* tweak badges

* tweak

* fix header link for cm6-graphql (graphql#3241)

* fix: reload schema when a change to the schema file is detected (graphql#3216)

* fix: Invalidate the schema when the file has been changed

* feat: add .json file ending to register changes in introspection files

* fix: handle all types of graphql schema

* feat: changeset

* Fix open vsx publish (graphql#2833)

* fix ovsx publishing
* attempt to get ovsx working
* fix: CLI invocation to publish local contexts

* Version Packages (alpha) (graphql#3219)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* reintroduce codecov (graphql#3244)

* reintroduce codecov

* fix path

* re-add coverage flag

* more config tweaks

* fix: run tests against main for baseline (graphql#3245)

* fix: run tests against main for baseline
* make e2e happen only on PRs
* fix codecov targets

* set target really low (graphql#3247)

* fix: restore tests without build workflow (graphql#3246)

* leave pre-release mode (graphql#3248)

* [plugin-code-exporter/plugin-explorer] update vite (graphql#3236)

* always bundle `package.json#dependencies` for UMD for `@graphiql/plugin-code-exporter` and `@graphiql/plugin-explorer` (graphql#3251)

* fix

* remove `/// <reference path='../../node_modules/monaco-editor/monaco.d.ts'/>` and simple import it (graphql#3238)

* remove `/// <reference path='../../node_modules/monaco-editor/monaco.d.ts'/>` and simple import it
* avoid `import * as monaco`
* prefer `import type * as monaco`

* [graphiql] remove unnecessary `<div />` wrappers (graphql#3235)

* update eslint plugins/prettier (graphql#3255)

* update lint

* update prettier

* simplify prettier checks commands, remove `script/pretty.js` (graphql#3259)

* [monaco-graphql]  remove newline trigger character (graphql#3253)

* fix release (graphql#3260)

* ignore package.jsons for cspell (graphql#3262)

* ignore `package.json`s for cspell

* better

* Update CONTRIBUTING.md (graphql#3261)

* improvements (graphql#3263)

* Delete index.js.flow (graphql#3256)

* Delete index.js.flow

* Delete index.js.flow

* Delete buildFlow.js (graphql#3257)

* Update .prettierignore

* fix exec and the dreaded code file loader bug (graphql#3266)

* fix exec and the dreaded code file loader bug
* fix: allow passing in additional extensions
* fix: eslint extension bundling externals

* Fix changesets (graphql#3268)

* Version Packages (graphql#3243)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix ovsx release (graphql#3269)

* Version Packages (graphql#3270)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix vscode-graphql-extension release (graphql#3271)

* Version Packages (graphql#3272)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix vscode issue with esbuild + vsce bundling (graphql#3274)

* Version Packages (graphql#3275)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* setup `@shopify/prefer-early-return` and `sonarjs/no-inverted-boolean-check` (graphql#3276)

* fixes for `prefer-class-properties` (graphql#3277)

Co-Authored-By: Dimitri POSTOLOV <dmytropostolov@gmail.com>

* enable avoidExplicitReturnArrows: true option for `object-shorthand` rule (graphql#3283)

* enable `prefer-arrow-callback` (graphql#3282)

* simplify `monaco-graphql-react-vite` example, fix sending variables (graphql#3140)

* lower codecov threshold

.1% seems forgiving enough

* simplify Next.js example + add symlinks to React Vite to maintain 2 examples from 1 place (graphql#3281)

* Delete types.js.flow (graphql#3286)

* remove unneeded mock to cross-fetch (graphql#3289)

* fix umd build names `graphiql-plugin-code-exporter.umd.js` and `graphiql-plugin-explorer.umd.js` (graphql#3292)

* Version Packages (graphql#3280)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix (graphql#3293)

* simplify imports from `graphql`, restrict some with eslint (graphql#3294)

* update regression test matrix (graphql#3296)

we only need to worry about old 15.x versions and latest 16.x that we support.

* add `/* GraphQL */` comments in merge-ast.spec.ts (graphql#3302)

* fix: run tests for commits that include markdown, etc changes

previously, if you opened a PR that included any markdown changes, even if there were also code changes, the ci would skip tests

essentially, `paths-ignore` does not work the way we hope

* Update README.md (graphql#3308)

* replace `express-graphql` with `graphql-http` (graphql#3310)

* replace `express-graphql` with `graphql-http`
* upgrade express

* Fix eslint errors (graphql#3315)

* fix(graphiql-plugin-explorer): Use named `Explorer` import from `graphiql-explorer` (graphql#3319)

* fix(graphiql-plugin-explorer): Use preferDefault helper

* Create shaggy-eyes-melt.md

* Update packages/graphiql-plugin-explorer/src/index.tsx

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>

* remaining fix to use explorer import

* adjust changelog

---------

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>

* Revert "update regression test matrix" (graphql#3320)

* Version Packages (graphql#3295)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [tooling] use cspell `--no-must-find-files` on git hooks, simplify output (graphql#3313)

* [documentation] fix `ISSUE_TEMPLATE` bugs (graphql#3321)

* fix ISSUE_TEMPLATE bugs

* `render: markdown` leads to a terrible experience for `textarea`, both
  for editing & reading the text
* almost everyone prefers using `*` for md lists over `-`
* eliminate sections that are confusing and rarely used (including the
  templates for `monaco-graphql`)
* convert the syntax bug reporting template to markdown, as there is
  little context that needs to be provided besides a screenshot
* type markdown -> type textarea

* [tooling] combine webpack builds for faster builds & simpler tooling (graphql#3323)

* fix: bypass parsing bugs to continue plucking tags (graphql#3322)

* avoid bundling unnecesary languages, except `graphql`/`json` (graphql#3285)

* simplify `monaco-graphql-react-vite`, fix sending variables

---------

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>

* [graphiql] fix graphql#2859, graphiql plugin lifecycle bugs, simplify plugins (graphql#3330)

- simplify plugin development
- simplify plugin implementation
- fix graphql#2859 cursor jumping issue
- drop the `use` prefix, because they should not be invoked as react hooks, but widely used eslint rules will assume they are hooks
- update examples for 0.2.0 breaking change
- consistent naming
  - `@graphiql/plugin-code-exporter` -> exports `codeExporterPlugin()` module
  - `@graphiql/plugin-explorer` ->  exports `explorerPlugin()` module

* `.prettierignore` => `.eslintignore`, mutual ignore rules, cleanup prettier config (graphql#3333)

* use ignorePatterns instead (graphql#3334)

another attempt to fix the eslint/prettier config mismatch on release

* Version Packages (graphql#3326)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Feat: history enhancements (graphql#3130)

- Adds a trash icon to delete individual items
- Adds a clear button to clear all history
- Changes so item not in both items list and favorites list
- Fixes so it edits the correct label if the same operation is in the list twice
- Adds a callback for when you click an item and it's set as the active item in editor (helpful for customizing UI based on when query changes)
- Pass in entire item and de-structure needed properties in history store instead (helpful if you're customizing to build your own <HistoryContext.Provider... i.e. customizing the addToHistory/editLabel/etc functions to use a backend instead of a local storage and may need a unique id or other properties. Without passing the entire item there's no way to receive those extra properties but passing the entire item allows that)
---------

Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: Myles Murphy <53157254+mylesmmurphy@users.noreply.github.com>

* handle null editor value in explorer plugin

* Version Packages

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jonathan Brennan <jonathanawesome@users.noreply.github.com>
Co-authored-by: Thomas Heyenbrock <thomas.heyenbrock@gmail.com>
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris <ccbrown112@gmail.com>
Co-authored-by: Rikki Schulte <rikki.schulte@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Stefan Schneider <stefan.schneider@gmx.net>
Co-authored-by: Elijah Olmos <35435704+elijaholmos@users.noreply.github.com>
Co-authored-by: Victor Tortolero <victormtortolero@gmail.com>
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: woodensail <woodensail@hotmail.com>
Co-authored-by: Samuel <samuelimolo4real@gmail.com>
Co-authored-by: Benoît Bouré <benoit.boure@gmail.com>
Co-authored-by: Ivan Buryak <11bit@users.noreply.github.com>
Co-authored-by: mizdra <pp.mizdra@gmail.com>
Co-authored-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
Co-authored-by: Benjie Gillam <benjie@jemjie.com>
Co-authored-by: Matt Mahoney <mahoney.mattj@gmail.com>
Co-authored-by: Sergei Chestakov <me@sergei.com>
Co-authored-by: Myles Murphy <53157254+mylesmmurphy@users.noreply.github.com>
Co-authored-by: Hugo van Rijswijk <git@hugovr.nl>
Co-authored-by: JYC <jycouet@gmail.com>
Co-authored-by: Sterling Camden <rusty.camden@gmail.com>
Co-authored-by: Aaron Moat <2937187+AaronMoat@users.noreply.github.com>
Co-authored-by: Mark Skelton <mdskelton99@gmail.com>
Co-authored-by: Zolwiastyl <45352717+Zolwiastyl@users.noreply.github.com>
Co-authored-by: puelo <tobias-ka@gmx.de>
Co-authored-by: Jake Harclerode <Jakobharclerode@gmail.com>
Co-authored-by: Daniel Woelfel <dwwoelfel@gmail.com>
Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
Co-authored-by: lesleydreyer <38596053+lesleydreyer@users.noreply.github.com>
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
Co-authored-by: Simen Owesen-Lein <simowe@attensi.com>
Co-authored-by: Lennart <lekoarts@gmail.com>
@maarcingebala
Copy link

We're currently using the 3.0.6 version of GraphiQL and are still experiencing the issue. It seems to happen less often, though.

@dimaMachina dimaMachina reopened this Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

9 participants