graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

fix: doc-explorer search combobox null checks

Open LBPeterson opened this issue 6 months ago • 2 comments

This PR adds a null check to fix a bug in the doc explorer that happens when the search field loses focus when there is no text in the search input. To reproduce in the Graphiql live demo:

  • Open the browser console
  • Open the Documentation Explorer (upper left)
  • Start searching in the pane
  • Delete your search term and click away from the search bar
  • See the console log this error: Uncaught TypeError: right-hand side of 'in' should be an object, got null

The cause: The headlessui combobox is nullable by default in ^2, a change in api from ^1 Our existing onChange handler does not expect null values to be passed

The fix: Add an early null check to the onChange handler

LBPeterson avatar Jun 17 '25 15:06 LBPeterson

🦋 Changeset detected

Latest commit: 6a8d630195e6edd2aa65a20d4358ccd2aeac13f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphiql/plugin-doc-explorer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 17 '25 15:06 changeset-bot[bot]

CLA Not Signed

closing due missing CLA

this issue will be fixed in the upcoming GraphiQL 5, which will be released tomorrow https://github.com/graphql/graphiql/pull/4030

dimaMachina avatar Jun 22 '25 13:06 dimaMachina