@graphiql/react
Advanced tools
Comparing version 0.20.1 to 0.20.2-canary-87150409.0
{ | ||
"name": "@graphiql/react", | ||
"version": "0.20.1", | ||
"version": "0.20.2-canary-87150409.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -14,3 +14,3 @@ import { fillLeafs, GetDefaultFieldNamesFn, mergeAst } from '@graphiql/toolkit'; | ||
import { onHasCompletion } from './completion'; | ||
import { useEditorContext } from './context'; | ||
import { DEFAULT_QUERY, useEditorContext } from './context'; | ||
import { CodeMirrorEditor } from './types'; | ||
@@ -353,6 +353,9 @@ | ||
const editorValue = editorInstance?.getValue(); | ||
if (editorValue) { | ||
if (editorValue && editorValue.length > 0 && editorValue !== DEFAULT_QUERY) { | ||
valueString = editorValue; | ||
} else { | ||
valueString = initialValue || ''; | ||
if (initialValue) { | ||
editorInstance?.setValue(valueString); | ||
} | ||
} | ||
@@ -373,7 +376,7 @@ | ||
*/ | ||
export function useOperationsEditorState( | ||
export const useOperationsEditorState = ( | ||
initialState?: InitialState, | ||
): [operations: string, setOperations: (content: string) => void] { | ||
): [operations: string, setOperations: (content: string) => void] => { | ||
return useEditorState('query', initialState); | ||
} | ||
}; | ||
@@ -383,7 +386,7 @@ /** | ||
*/ | ||
export function useVariablesEditorState( | ||
export const useVariablesEditorState = ( | ||
initialState?: InitialState, | ||
): [variables: string, setVariables: (content: string) => void] { | ||
): [variables: string, setVariables: (content: string) => void] => { | ||
return useEditorState('variable', initialState); | ||
} | ||
}; | ||
@@ -393,6 +396,6 @@ /** | ||
*/ | ||
export function useHeadersEditorState( | ||
export const useHeadersEditorState = ( | ||
initialState?: InitialState, | ||
): [headers: string, setHeaders: (content: string) => void] { | ||
): [headers: string, setHeaders: (content: string) => void] => { | ||
return useEditorState('header', initialState); | ||
} | ||
}; |
@@ -24,3 +24,4 @@ import { Context, createContext, useContext } from 'react'; | ||
`Tried to use \`${ | ||
options.caller?.name || useGivenContext.caller.name | ||
// options.caller?.name || useGivenContext.caller.name | ||
'' | ||
}\` without the necessary context. Make sure to render the \`${ | ||
@@ -27,0 +28,0 @@ context.displayName |
@@ -228,1 +228,2 @@ import { DocumentNode, FragmentDefinitionNode, OperationDefinitionNode, ValidationRule } from 'graphql'; | ||
}; | ||
export declare const DEFAULT_QUERY = "# Welcome to GraphiQL\n#\n# GraphiQL is an in-browser tool for writing, validating, and\n# testing GraphQL queries.\n#\n# Type queries into this side of the screen, and you will see intelligent\n# typeaheads aware of the current GraphQL type schema and live syntax and\n# validation errors highlighted within the text.\n#\n# GraphQL queries typically start with a \"{\" character. Lines that start\n# with a # are ignored.\n#\n# An example GraphQL query might look like:\n#\n# {\n# field(arg: \"value\") {\n# subField\n# }\n# }\n#\n# Keyboard shortcuts:\n#\n# Prettify query: Shift-Ctrl-P (or press the prettify button)\n#\n# Merge fragments: Shift-Ctrl-M (or press the merge button)\n#\n# Run Query: Ctrl-Enter (or press the play button)\n#\n# Auto Complete: Ctrl-Space (or just start typing)\n#\n\n"; |
@@ -56,11 +56,11 @@ import { GetDefaultFieldNamesFn } from '@graphiql/toolkit'; | ||
*/ | ||
export declare function useOperationsEditorState(initialState?: InitialState): [operations: string, setOperations: (content: string) => void]; | ||
export declare const useOperationsEditorState: (initialState?: InitialState | undefined) => [operations: string, setOperations: (content: string) => void]; | ||
/** | ||
* useState-like hook for current tab variables editor state | ||
*/ | ||
export declare function useVariablesEditorState(initialState?: InitialState): [variables: string, setVariables: (content: string) => void]; | ||
export declare const useVariablesEditorState: (initialState?: InitialState | undefined) => [variables: string, setVariables: (content: string) => void]; | ||
/** | ||
* useState-like hook for current tab variables editor state | ||
*/ | ||
export declare function useHeadersEditorState(initialState?: InitialState): [headers: string, setHeaders: (content: string) => void]; | ||
export declare const useHeadersEditorState: (initialState?: InitialState | undefined) => [headers: string, setHeaders: (content: string) => void]; | ||
export {}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4612280
28350