graphql-react
Advanced tools
Changelog
8.3.0
response
property to the GraphQL
instance cache
event payload, containing the original fetch
Response
instance the cacheValue
was derived from.useGraphQL
options guide for common situations.GraphQL
instance method operate
with both reloadOnLoad
and resetOnLoad
options true
.FormData
field names, as some FormData
polyfills don't coerce numbers like native implementations do.Changelog
8.2.0
GraphQLProvider
component that prevents unnecessary loading on the client after SSR, fixing #4. This component should be used instead of using GraphQLContext.Provider
directly. The old way still works, but with the old behavior.GraphQLContext.Consumer
example to use React hooks.Changelog
8.1.3
size-limit
config file name.useGraphQL
render error when options reloadOnLoad
and resetOnLoad
are both true
.useGraphQL
to track mounted status for cache related callbacks.GraphQL
instance method operate
option reloadOnLoad
.Changelog
8.1.2
useGraphQL
to use useCallback
and added hook dependency arrays, to fix a recently appearing react-hooks/exhaustive-deps
lint error and hopefully reduce render work.package.json
by moving dev tool config to files. This also prevents editor extensions such as Prettier and ESLint from detecting config and attempting to operate when opening package files installed in node_modules
.Changelog
8.1.1
useGraphQL
internal useEffect
React hook second arguments.useGraphQL
React hook is unmounted soon after an GraphQL
instance event such as reset
is emitted.Changelog
8.1.0
GraphQL
instance method reload
which fires a reload
event signaling that GraphQL cache subscribers such as the useGraphQL
React hook should reload their GraphQL operation, fixing #26.useGraphQL
React hook reloadOnLoad
option.useGraphQL
React hook loadOnMount
option implementation that fixes ESLint react-hooks/exhaustive-deps
rule errors.function
instead of const
declarations in places to simplify transpiled output.GraphQL.reset()
test name typo fix.useGraphQL
React hook reloadOnLoad
and resetOnLoad
options.GraphQL
instance event documentation.Changelog
8.0.2
useGraphQL
React hook bug fix for when arguments change after the initial render and the load
function is called: loading
and cacheValue
now update correctly after the operation loads.Changelog
8.0.1
useGraphQL
React hook bug fixes for when arguments change after the initial render:
cacheKey
to change trigger a reload if the loadOnMount
option is true
, fixing #23.react-test-renderer
to test useGraphQL
with a lot more detail.React
namespace in useGraphQL
.hashObject()
tests.Changelog
8.0.0
Updated the react
and react-dom
peer dependencies to ^16.8.0
.
Removed the Query
component.
No longer exporting Provider
and Consumer
; now GraphQLContext
is exported.
The GraphQL
instance method query
has been renamed operate
.
The GraphQL
constructor no longer has the logErrors
option, and GraphQL operation errors are no longer console logged by default.
The ssr
function is now exported from graphql-react/server
instead of graphql-react/lib/ssr
.
The ssr
function is now implemented using async
/await
syntax.
Browser (and less commonly server) environments that fetch GraphQL operations with file uploads must now support (natively or by polyfill) the FormData.entries()
API.
Caching of GraphQL multipart requests when the fetch
options body
is a FormData
instance has been improved. Previously they would overwrite each other in the cache even if the GraphQL operations were different, depending if the FormData
instance was native or from a polyfill that could be JSON serialized.
There is still room to improve as FormData
field values that are File
or Blob
instances don’t influence the cache key hashing.
GraphQL
event properties have been renamed or added:
fetch
event property fetchOptionsHash
was renamed cacheKey
, and the property cache
was renamed cacheValuePromise
.cache
event property fetchOptionsHash
was renamed cacheKey
, and the property cacheValue
was added.reset
event property exceptFetchOptionsHash
was renamed exceptCacheKey
.useGraphQL
React hook, which assumes the role of the removed Query
component.GraphQL
on
and off
methods for managing event listeners.reportCacheErrors
function, a GraphQL
cache
event handler that can be setup to report GraphQL operation errors via console.log()
.prepublishOnly
script.tap
CLI and default reporter for tests.test
script as they are the slowest.Changelog
7.0.0
preload
function. It was not going to work with React hooks.react-dom
peer dependency.main
package entry).ssr
function, which is for server use only and is React hooks ready. It is simpler and more future-proof than the removed preload
function as it leverages ReactDOMServer
for rendering.GraphQL
now emits a cache
promise in the fetch
event payload. These events are undocumented, so this could be considered an internal change.ReactNode
JSDoc type, replacing ReactElement
types.preload
function.