Skip to content

[graphiql] graphiql is failing on v4 #3917

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
1 task done
sibelius opened this issue May 4, 2025 · 1 comment
Open
1 task done

[graphiql] graphiql is failing on v4 #3917

sibelius opened this issue May 4, 2025 · 1 comment

Comments

@sibelius
Copy link

sibelius commented May 4, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

'use client'

import { GraphiQL } from 'graphiql'
import 'graphiql/style.css'

export default function GraphiQLPage() {
  return (
    <div style={{ height: '100vh' }}>
      <GraphiQL fetcher={async (graphQLParams) => {
        const response = await fetch('/api/graphql', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify(graphQLParams),
        })
        return response.json()
      }} />
    </div>
  )
}

this setup is throwing an error

TypeError: Cannot read properties of undefined (reading 'addEventListener')
    at VisualElementDragControls.addListeners (VisualElementDragControls.mjs:406:54)
    at DragGesture.mount (index.mjs:19:46)
    at HTMLVisualElement.updateFeatures (VisualElement.mjs:254:29)
    at useVisualElement.useIsomorphicLayoutEffect (use-visual-element.mjs:69:23)
    at react-stack-bottom-frame (react-dom-client.development.js:23054:20)
    at runWithFiberInDEV (react-dom-client.development.js:844:30)
    at commitHookEffectListMount (react-dom-client.development.js:11977:29)
    at commitHookLayoutEffects (react-dom-client.development.js:11927:11)
    at reappearLayoutEffects (react-dom-client.development.js:13745:11)
The above error occurred in the <MotionComponent> component. It was handled by the <ErrorBoundary> error boundary.

Expected Behavior

it should not break

Steps To Reproduce

create a nextjs app dir

try to render graphiql in a client side page, it will break

Environment

  • GraphiQL Version: ^4.0.1
  • OS: mac
  • Browser: chrome
  • Bundler: nextjs app dir
  • react Version: 19.0.0
  • graphql Version: 16.11.0

Anything else?

No response

@dimaMachina
Copy link
Collaborator

please provide runnable reproduction, so it could be fixed asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants