Skip to content

Releases: jaydenseric/graphql-react

Version 8.3.0

16 Jul 05:30
Compare
Choose a tag to compare

Minor

  • Added a response property to the GraphQL instance cache event payload, containing the original fetch Response instance the cacheValue 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 method operate with both reloadOnLoad and resetOnLoad options true.
  • Use string FormData field names, as some FormData 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

15 Apr 09:26
Compare
Choose a tag to compare

Minor

  • Added a new 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.

Patch

  • Updated dev dependencies.
  • Updated the GraphQLContext.Consumer example to use React hooks.

Version 8.1.3

10 Apr 12:31
Compare
Choose a tag to compare

Patch

  • Updated dependencies.
  • Adopted the new size-limit config file name.
  • Slightly faster useGraphQL render error when options reloadOnLoad and resetOnLoad are both true.
  • Use a ref instead of a variable in useGraphQL to track mounted status for cache related callbacks.
  • Document the GraphQL instance method operate option reloadOnLoad.
  • Minor readme quotes consistency tweak.

Version 8.1.2

31 Mar 05:47
Compare
Choose a tag to compare

Patch

  • Updated dependencies.
  • Updated 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.
  • 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 in node_modules.
  • Discuss Apollo Client fragment matcher config in the “Apollo comparison” readme section.

Version 8.1.1

01 Mar 02:54
Compare
Choose a tag to compare

Patch

  • Updated a dev dependency.
  • Removed redundant useGraphQL internal useEffect 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 an GraphQL instance event such as reset is emitted.

Version 8.1.0

27 Feb 03:44
Compare
Choose a tag to compare

Minor

  • Added the 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.
  • Added the useGraphQL React hook reloadOnLoad option.

Patch

  • Updated dependencies.
  • More reliable useGraphQL React hook loadOnMount option implementation that fixes ESLint react-hooks/exhaustive-deps rule errors.
  • Use function instead of const declarations in places to simplify transpiled output.
  • GraphQL.reset() test name typo fix.
  • Added tests for the useGraphQL React hook reloadOnLoad and resetOnLoad 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

22 Feb 07:46
Compare
Choose a tag to compare

Patch

  • Updated dev dependencies.
  • 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.

Version 8.0.1

20 Feb 10:53
Compare
Choose a tag to compare

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 the loadOnMount option is true, fixing #23.
    • Fixed stale operation status properties being returned.
  • Use react-test-renderer to test useGraphQL with a lot more detail.
  • Capitalized the React namespace in useGraphQL.
  • Improved hashObject() tests.

Version 8.0.0

15 Feb 12:33
Compare
Choose a tag to compare

Major

  • 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:

    • The fetch event property fetchOptionsHash was renamed cacheKey, and the property cache was renamed cacheValuePromise.
    • The cache event property fetchOptionsHash was renamed cacheKey, and the property cacheValue was added.
    • The reset event property exceptFetchOptionsHash was renamed exceptCacheKey.

Minor

  • Added the useGraphQL React hook, which assumes the role of the removed Query component.
  • Documented the GraphQL on and off methods for managing event listeners.
  • Added the reportCacheErrors function, a GraphQL cache event handler that can be setup to report GraphQL operation errors via console.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

29 Jan 08:03
Compare
Choose a tag to compare

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 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.

Patch

  • Updated dependencies.
  • Handle exceptions outside tests (see tapjs/node-tap#463 (comment)).
  • Added a ReactNode JSDoc type, replacing ReactElement types.
  • Removed tests made redundant by the removal of the preload function.
  • Document the official Next.js example.
  • Improved documentation.