Skip to content

Commit 3b642aa

Browse files
authored
Add react hooks to CDN bundle (#2699)
1 parent 3acacf5 commit 3b642aa

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

.changeset/strange-mirrors-yell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphiql': patch
3+
---
4+
5+
Export hooks in CDN bundle

packages/graphiql/src/cdn.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,22 @@ import '@graphiql/react/dist/style.css';
1414
import './style.css';
1515

1616
import { GraphiQL } from './components/GraphiQL';
17+
18+
import {
19+
useEditorContext,
20+
useExecutionContext,
21+
useSchemaContext,
22+
} from '@graphiql/react';
23+
1724
// add the static function here for CDN only. otherwise, doing this in the component could
1825
// add unwanted dependencies to the bundle.
1926
// @ts-expect-error
2027
GraphiQL.createFetcher = createGraphiQLFetcher;
28+
// @ts-expect-error
29+
GraphiQL.useEditorContext = useEditorContext;
30+
// @ts-expect-error
31+
GraphiQL.useExecutionContext = useExecutionContext;
32+
// @ts-expect-error
33+
GraphiQL.useSchemaContext = useSchemaContext;
2134

2235
export default GraphiQL;

0 commit comments

Comments
 (0)