graphql-react

A GraphQL client for React using modern context and hooks APIs that is lightweight (< 4 kB) but powerful; the first Relay and Apollo alternative with server side rendering.

MIT License

Downloads
8.3K
Stars
715
Committers
3

Bot releases are hidden (Show)

graphql-react - Version 8.3.0

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.2.0

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.1.3

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.1.2

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.1.1

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.1.0

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.0.2

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.0.1

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 8.0.0

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 7.0.0

Published by jaydenseric over 5 years ago

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.
graphql-react - Version 6.0.1

Published by jaydenseric almost 6 years ago

Patch

  • Updated dev dependencies.
  • Removed the watch dev dependency and watch package script.
  • preload now properly catches render errors nested under Query components.
  • preload now supports class components that don’t call their base constructor with props, fixing #17.
  • Fixed a prop type warning in one of the tests.
  • Fixed example code typos in the readme “Usage” section.
  • Fixed incorrect graphQLErrors JSDoc type.
graphql-react - Version 6.0.0

Published by jaydenseric almost 6 years ago

Major

  • Made preload reject upon render errors instead of throwing.

Minor

  • Made Query component throw a helpful render error if the GraphQL context is missing.

Patch

  • Updated dev dependencies.
  • Improved size-limit tests:
    • Drop the CJS entrypoint; modern bundlers don’t use it and nested module imports revert resolve ESM anyway.
    • Ignore prop-types since it’s likely to already be present in a React project, and most frameworks strip it out in production bundles anyway.
    • Separately limit and test server and client bundles.
graphql-react - Version 5.0.0

Published by jaydenseric almost 6 years ago

Major

  • Updated the extract-files dependency to v5:
    • The original operation object is no longer modified when it contains files.
    • If the same file is used in multiple locations of an operation it is only uploaded once.

Patch

  • Updated dependencies.
  • Removed a redundant .prettierignore entry.
  • Added tests for the internal graphqlFetchOptions function.
graphql-react - Version 4.2.0

Published by jaydenseric almost 6 years ago

Minor

  • Added a new GraphQL constructor option logErrors (default true) and instance property, controlling if GraphQL request errors should be console logged for easy debugging.

Patch

  • Updated dependencies.
  • Refactored GraphQL static methods to separate modules.
  • Moved JSDoc type definitions into the index file.
  • Manually composed package exports instead of relying on *.
  • More consistent object snapshots in tests.
graphql-react - Version 4.1.0

Published by jaydenseric almost 6 years ago

Minor

Patch

graphql-react - Version 4.0.1

Published by jaydenseric almost 6 years ago

Patch

  • Fixed preload for production NODE_ENV, fixing #11 and #12.
  • preload now scopes context under providers.
  • Removed redundant uses of this in the internal GraphQLQuery component constructor.
  • Test the library with undefined and production NODE_ENV.
graphql-react - Version 4.0.0

Published by jaydenseric almost 6 years ago

Major

Patch

  • Updated dev dependencies.
graphql-react - Version 3.0.0

Published by jaydenseric about 6 years ago

Major

  • The Query (and the internal GraphQLQuery) component take an operation prop instead of separate variables and query props. This makes the implementation a little more elegant, is more consistent with the GraphQL.query API and allows sending custom GraphQL operation fields.
  • New internal event system, fixing #10. Now the loading parameter of Query component render functions change when identical requests are loaded elsewhere in the app.

Minor

  • Improved Provider and Consumer component display names in React dev tools:
    • Context.ProviderGraphQLContext.Provider
    • Context.ConsumerGraphQLContext.Consumer

Patch

  • Updated dependencies.
  • Updated package scripts and config for the new husky version.
  • Removed the package module field. Webpack by default resolves extensionless paths the same way Node.js in --experimental-modules mode does; .mjs files are preferred. Tools misconfigured or unable to resolve .mjs can get confused when module points to an .mjs ESM file and they attempt to resolve named imports from .js CJS files.
  • Renamed the Operation type GraphQLOperation.
  • Use jsDelivr for the readme logo instead of RawGit as they are shutting down.
graphql-react - Version 2.0.1

Published by jaydenseric about 6 years ago

Patch

  • Updated dependencies.
  • Remove the GraphQLQuery component from API documentation as it used internally and is not exported.
  • Regenerated the readme API docs using the latest jsdoc-md version.
  • Added a new “Usage” readme section.
  • Fixed a link in the readme.
  • Fixed example GraphQL query typos.
graphql-react - Version 2.0.0

Published by jaydenseric about 6 years ago

Major

  • Updated Node.js support from v7.6+ to v8.5+.

Minor

Patch

  • Updated dependencies.
  • Removed the rimraf dev dependency in favour of a native rm -rf package clean script. Leaner and faster; we only support *nix for contributing anyway.
  • Fixed new Prettier lint errors and removed the fake-tag dev dependency now that Prettier can format template literals tagged with /* GraphQL */.
  • Stopped using npm-run-all for package scripts to reduce complexity and bugs.
  • Compact package repository field.
  • Added more package tags.
  • Lint .yml files.
  • Test with graphql-api-koa instead of express-graphql.
  • Fixed test snapshot consistency between Node.js versions (see tapjs/node-tap#450).
  • Use jsdoc-md instead of documentation to generate readme API docs.
  • JSDoc fixes and improvements.
  • Readme badge changes to deal with shields.io unreliability:
    • Used the more reliable build status badge provided by Travis, configured to only track master branch.
    • Removed the licence badge. The licence can be found in package.json and rarely changes.
    • Removed the Github issues and stars badges. The readme is most viewed on Github anyway.
    • Use Badgen for the npm version badge.