File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
graphiql-plugin-code-exporter/src
graphiql-plugin-explorer/src Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @graphiql/plugin-explorer ' : patch
3
+ ---
4
+
5
+ handle null editor in explorer plugin
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ function GraphiQLCodeExporterPlugin(props: GraphiQLCodeExporterPluginProps) {
21
21
) ;
22
22
}
23
23
24
- export function codeExporterPlugin ( props : GraphiQLCodeExporterPluginProps ) {
24
+ export function codeExporterPlugin (
25
+ props : GraphiQLCodeExporterPluginProps ,
26
+ ) : GraphiQLPlugin {
25
27
return {
26
28
title : 'GraphiQL Code Exporter' ,
27
29
icon : ( ) => (
@@ -42,5 +44,5 @@ export function codeExporterPlugin(props: GraphiQLCodeExporterPluginProps) {
42
44
content ( ) {
43
45
return < GraphiQLCodeExporterPlugin { ...props } /> ;
44
46
} ,
45
- } as GraphiQLPlugin ;
47
+ } ;
46
48
}
Original file line number Diff line number Diff line change @@ -135,10 +135,12 @@ function ExplorerPlugin(props: GraphiQLExplorerPluginProps) {
135
135
) ;
136
136
// todo: document how to do this!
137
137
const handleEditOperation = useCallback (
138
- ( value : string ) => queryEditor ! . setValue ( value ) ,
138
+ ( value : string ) => queryEditor ? .setValue ( value ) ,
139
139
[ queryEditor ] ,
140
140
) ;
141
141
142
+ const operationDocument = queryEditor ?. getValue ( ) ?? '' ;
143
+
142
144
return (
143
145
< GraphiQLExplorer
144
146
schema = { schema }
@@ -150,7 +152,7 @@ function ExplorerPlugin(props: GraphiQLExplorerPluginProps) {
150
152
checkboxUnchecked = { checkboxUnchecked }
151
153
checkboxChecked = { checkboxChecked }
152
154
styles = { styles }
153
- query = { queryEditor ! . getValue ( ) }
155
+ query = { operationDocument }
154
156
onEdit = { handleEditOperation }
155
157
{ ...props }
156
158
/>
You can’t perform that action at this time.
0 commit comments