@graphiql/react
Advanced tools
Comparing version 0.28.0 to 0.28.1-canary-47ea44d2.0
{ | ||
"name": "@graphiql/react", | ||
"version": "0.28.0", | ||
"version": "0.28.1-canary-47ea44d2.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -6,3 +6,4 @@ import { fillLeafs, GetDefaultFieldNamesFn, mergeAst } from '@graphiql/toolkit'; | ||
import { parse, print } from 'graphql'; | ||
import { useEffect, useRef, useState } from 'react'; | ||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports -- TODO: check why query builder update only 1st field https://github.com/graphql/graphiql/issues/3836 | ||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; | ||
@@ -348,5 +349,4 @@ import { useExplorerContext } from '../explorer'; | ||
export const useEditorState = ( | ||
editor: 'query' | 'variable' | 'header', | ||
): [string, (val: string) => void] => { | ||
export const useEditorState = (editor: 'query' | 'variable' | 'header') => { | ||
'use no memo'; // eslint-disable-line react-compiler/react-compiler -- TODO: check why query builder update only 1st field https://github.com/graphql/graphiql/issues/3836 | ||
const context = useEditorContext({ | ||
@@ -363,4 +363,10 @@ nonNull: true, | ||
const handleEditorValue = (value: string) => editorInstance?.setValue(value); | ||
return [valueString, handleEditorValue]; | ||
const handleEditorValue = useCallback( | ||
(value: string) => editorInstance?.setValue(value), | ||
[editorInstance], | ||
); | ||
return useMemo<[string, (val: string) => void]>( | ||
() => [valueString, handleEditorValue], | ||
[valueString, handleEditorValue], | ||
); | ||
}; | ||
@@ -367,0 +373,0 @@ |
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
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
2112727
28548