Skip to content

Commit

Permalink
fix(graphiql-plugin-explorer): Use named Explorer import from `grap…
Browse files Browse the repository at this point in the history
…hiql-explorer` (#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>
  • Loading branch information
LekoArts and Dimitri POSTOLOV authored Jul 4, 2023
1 parent 2f15e20 commit 2f51b1a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shaggy-eyes-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphiql/plugin-explorer": patch
---

Use named `Explorer` import from `graphiql-explorer` to fix an issue where the bundler didn't correctly choose either the `default` or `Explorer` import. This change should ensure that `@graphiql/plugin-explorer` works correctly without `graphiql-explorer` being bundled.
2 changes: 2 additions & 0 deletions packages/graphiql-plugin-explorer/src/graphiql-explorer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,7 @@ declare module 'graphiql-explorer' {
defaultValue: (arg: GraphQLLeafType) => ValueNode;
};

export { GraphiQLExplorer as Explorer };

export default GraphiQLExplorer;
}
6 changes: 5 additions & 1 deletion packages/graphiql-plugin-explorer/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
useExecutionContext,
useSchemaContext,
} from '@graphiql/react';
import GraphiQLExplorer, { GraphiQLExplorerProps } from 'graphiql-explorer';
import {
Explorer as GraphiQLExplorer,
GraphiQLExplorerProps,
} from 'graphiql-explorer';
import React, { useCallback, useRef } from 'react';

import './graphiql-explorer.d.ts';
Expand Down Expand Up @@ -71,6 +74,7 @@ const checkboxUnchecked = (
<circle cx="7.5" cy="7.5" r="6" stroke="currentColor" fill="none" />
</svg>
);

const checkboxChecked = (
<svg
viewBox="0 0 15 15"
Expand Down

0 comments on commit 2f51b1a

Please sign in to comment.