Releases: jaydenseric/graphql-react
Version 8.3.0
Minor
- Added a
response
property to theGraphQL
instancecache
event payload, containing the originalfetch
Response
instance thecacheValue
was derived from.
Patch
- Updated dependencies.
- Increased the post SSR hydration time from 500 to 1000 milliseconds, closing #37.
- Added a
useGraphQL
options guide for common situations. - Test the
GraphQL
instance methodoperate
with bothreloadOnLoad
andresetOnLoad
optionstrue
. - Use string
FormData
field names, as someFormData
polyfills don't coerce numbers like native implementations do. - Test files in variables result in appropriate fetch options for a valid GraphQL multipart request.
- Tidied test names.
- Nicer Browserslist syntax for supported Node.js versions.
Version 8.2.0
Minor
- Added a new
GraphQLProvider
component that prevents unnecessary loading on the client after SSR, fixing #4. This component should be used instead of usingGraphQLContext.Provider
directly. The old way still works, but with the old behavior.
Patch
- Updated dev dependencies.
- Updated the
GraphQLContext.Consumer
example to use React hooks.
Version 8.1.3
Patch
- Updated dependencies.
- Adopted the new
size-limit
config file name. - Slightly faster
useGraphQL
render error when optionsreloadOnLoad
andresetOnLoad
are bothtrue
. - Use a ref instead of a variable in
useGraphQL
to track mounted status for cache related callbacks. - Document the
GraphQL
instance methodoperate
optionreloadOnLoad
. - Minor readme quotes consistency tweak.
Version 8.1.2
Patch
- Updated dependencies.
- Updated
useGraphQL
to useuseCallback
and added hook dependency arrays, to fix a recently appearingreact-hooks/exhaustive-deps
lint error and hopefully reduce render work. - Reduced the size of the published
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 innode_modules
. - Discuss Apollo Client fragment matcher config in the “Apollo comparison” readme section.
Version 8.1.1
Patch
- Updated a dev dependency.
- Removed redundant
useGraphQL
internaluseEffect
React hook second arguments. - Fixed “Can't perform a React state update on an unmounted component” warnings if the component using the
useGraphQL
React hook is unmounted soon after anGraphQL
instance event such asreset
is emitted.
Version 8.1.0
Minor
- Added the
GraphQL
instance methodreload
which fires areload
event signaling that GraphQL cache subscribers such as theuseGraphQL
React hook should reload their GraphQL operation, fixing #26. - Added the
useGraphQL
React hookreloadOnLoad
option.
Patch
- Updated dependencies.
- More reliable
useGraphQL
React hookloadOnMount
option implementation that fixes ESLintreact-hooks/exhaustive-deps
rule errors. - Use
function
instead ofconst
declarations in places to simplify transpiled output. GraphQL.reset()
test name typo fix.- Added tests for the
useGraphQL
React hookreloadOnLoad
andresetOnLoad
options. - Increased the browser bundle size limit to 2.5 KB as the new features grew the bundle size from ~1.95 KB to ~2.13 KB.
- Improved
GraphQL
instance event documentation.
Version 8.0.2
Patch
- Updated dev dependencies.
useGraphQL
React hook bug fix for when arguments change after the initial render and theload
function is called:loading
andcacheValue
now update correctly after the operation loads.
Version 8.0.1
Patch
- Updated dev dependencies.
useGraphQL
React hook bug fixes for when arguments change after the initial render:- Changes that cause the
cacheKey
to change trigger a reload if theloadOnMount
option istrue
, fixing #23. - Fixed stale operation status properties being returned.
- Changes that cause the
- Use
react-test-renderer
to testuseGraphQL
with a lot more detail. - Capitalized the
React
namespace inuseGraphQL
. - Improved
hashObject()
tests.
Version 8.0.0
Major
-
Updated the
react
andreact-dom
peer dependencies to^16.8.0
. -
Removed the
Query
component. -
No longer exporting
Provider
andConsumer
; nowGraphQLContext
is exported. -
The
GraphQL
instance methodquery
has been renamedoperate
. -
The
GraphQL
constructor no longer has thelogErrors
option, and GraphQL operation errors are no longer console logged by default. -
The
ssr
function is now exported fromgraphql-react/server
instead ofgraphql-react/lib/ssr
. -
The
ssr
function is now implemented usingasync
/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
optionsbody
is aFormData
instance has been improved. Previously they would overwrite each other in the cache even if the GraphQL operations were different, depending if theFormData
instance was native or from a polyfill that could be JSON serialized.There is still room to improve as
FormData
field values that areFile
orBlob
instances don’t influence the cache key hashing. -
GraphQL
event properties have been renamed or added:- The
fetch
event propertyfetchOptionsHash
was renamedcacheKey
, and the propertycache
was renamedcacheValuePromise
. - The
cache
event propertyfetchOptionsHash
was renamedcacheKey
, and the propertycacheValue
was added. - The
reset
event propertyexceptFetchOptionsHash
was renamedexceptCacheKey
.
- The
Minor
- Added the
useGraphQL
React hook, which assumes the role of the removedQuery
component. - Documented the
GraphQL
on
andoff
methods for managing event listeners. - Added the
reportCacheErrors
function, aGraphQL
cache
event handler that can be setup to report GraphQL operation errors viaconsole.log()
.
Patch
- Updated dev dependencies.
- Updated the package description and keywords.
- Simplified the
prepublishOnly
script. - Use the
tap
CLI and default reporter for tests. - New project directory structure.
- Separate Babel configs for optimal universal, server, and test environment code.
- Much improved tests.
- Run size limit tests last in the package
test
script as they are the slowest. - Smaller package size limits for server (3 KB down to 2.5 KB) and browser (2.5 KB down to 2 KB) environments.
- Improved JSDoc types and API documentation.
- Updated the readme intro and added a new “Apollo comparison” section.
Version 7.0.0
Major
- Removed the
preload
function. It was not going to work with React hooks. - Added the
react-dom
peer dependency. - Reorganized file structure. This is only a breaking change for consumers that were not importing the documented way (via the
main
package entry).
Minor
- Added a
ssr
function, which is for server use only and is React hooks ready. It is simpler and more future-proof than the removedpreload
function as it leveragesReactDOMServer
for rendering. GraphQL
now emits acache
promise in thefetch
event payload. These events are undocumented, so this could be considered an internal change.
Patch
- Updated dependencies.
- Handle exceptions outside tests (see tapjs/node-tap#463 (comment)).
- Added a
ReactNode
JSDoc type, replacingReactElement
types. - Removed tests made redundant by the removal of the
preload
function. - Document the official Next.js example.
- Improved documentation.