[Graphiql Explorer Plugin] (Next.js) Cursor/Caret jumps when editing query manually
See original GitHub issueIs 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
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10
Top Results From Across the Web
Troubleshooting JSS Next.js apps - Sitecore Documentation
Try opening the GraphiQL interface in a browser, using values from your config ( <sitecore hostname + graphQL endpoint>/ui?sc_apikey=<api key> ) ...
Read more >apollo-server-errors | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >How To Build A GraphQL Server Using Next.js API Routes
This guide will teach you the basics of Next.js API Routes. We will start by explaining what they are and why API Routes...
Read more >sitemap-forums2.xml - Syncfusion
... https://www.syncfusion.com/forums/141073/how-to-prevent-edit-next-cell-in- ... /forums/142661/manually-setting-totalrecordcount-pagecount-with-js-data ...
Read more >NextJS, Contentful CMS, GraphQL, oh my! - Ben Holmes
; How to talk to GraphQL server + debug with GraphiQL; How we can roll query results into a static NextJS site with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.react
Version: 18.2.0graphql
Version: 16.6.0In 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.