Skip to content

Latest commit

 

History

History
913 lines (666 loc) · 49.4 KB

changelog.md

File metadata and controls

913 lines (666 loc) · 49.4 KB

graphql-react changelog

Next

Major

  • Updated Node.js support to ^18.18.0 || ^20.9.0 || >=21.1.0.
  • Use the Node.js test runner API and remove the dev dependency test-director.
  • Refactored tests to use the standard AbortController, AbortSignal, Event, EventTarget, File, FormData, and Response APIs available in modern Node.js and removed the dev dependencies abort-controller, event-target-shim, and node-fetch.

Patch

  • Updated the package.json field repository to conform to new npm requirements.
  • Updated GitHub Actions CI config:
    • Run tests with Node.js v18, v20, v21.
    • Updated actions/checkout to v4.
    • Updated actions/setup-node to v4.

20.0.0

Major

Patch

  • Updated the extract-files dependency to v13.
  • Updated dev dependencies.
  • Use the node: URL scheme for Node.js builtin module imports in tests.
  • Updated ESLint config.
  • Replaced TypeScript Record types with index signatures.
  • Added missing readme “Installation” section import map instructions for is-plain-obj.
  • Added Browserslist links to the readme.
  • Tweaked the readme.
  • Fixed broken links in the readme.
  • Fixed a broken link in the v13.0.0 changelog entry.

19.0.0

Major

  • Updated Node.js support to ^14.17.0 || ^16.0.0 || >= 18.0.0.

Patch

  • Updated the react peer dependency to 16.14 - 18.
  • Removed the redundant react-dom peer dependency.
  • Updated dependencies.
  • Removed the @testing-library/react-hooks dev dependency and rewrote React hook tests using react-test-renderer, a new test utility function createReactTestRenderer, and a custom React component ReactHookTest.
  • Removed the fetch-blob and formdata-node dev dependencies. Instead, File and FormData are imported from node-fetch.
  • Updated jsconfig.json:
    • Set compilerOptions.maxNodeModuleJsDepth to 10.
    • Set compilerOptions.module to nodenext.
  • Updated GitHub Actions CI config:
    • Run tests with Node.js v14, v16, v18.
  • Removed the now redundant not IE > 0 from the Browserslist query.
  • Updated react-dom/server imports in tests to suit React v18.
  • Fixed the fetchGraphQL test with the global fetch API unavailable for new versions of Node.js that have the fetch global.
  • Use globalThis instead of global in tests.
  • Use ReactTestRenderer instead of ReactDOMServer.renderToStaticMarkup in some React context related tests.
  • Removed some unnecessary JSDoc comments in tests.
  • Fixed some JSDoc links.
  • Revamped the readme:

18.0.0

Major

  • Renamed the type FetchGraphQLResultErrors to FetchGraphQLResultError in fetchGraphQL.mjs.

Minor

  • Added the new type FetchGraphQLResultErrorLoading to fetchGraphQL.mjs containing the GraphQL result error types related to loading that are generated on the client, not the GraphQL server.

Patch

  • Updated dev dependencies.
  • Simplified dev dependencies and config for ESLint.
  • Updated GitHub Actions CI config.
  • Fixed issues with GraphQL result related types from types.mjs.
  • Improved various JSDoc descriptions.
  • Improved the types relating to the Deferred class used in tests.

17.0.0

Major

Patch

  • Updated dev dependencies.
  • Sorted the contents of the package files and exports fields.
  • Removed the jsdoc-md dev dependency and the package docs-update and docs-check scripts, replacing the readme “API” section with a manually written “Exports” section.
  • Check TypeScript types via a new package types script.
  • Replaced the formdata-node dev dependency with formdata-polyfill and fetch-blob.
  • Updated GraphQL spec URLs in JSDoc and regular comments.
  • Readme tweaks.
  • Added a license.md MIT License file, fixing #54.

16.0.0

Major

  • Updated Node.js support to ^12.22.0 || ^14.17.0 || >= 16.0.0.
  • Updated dependencies, some of which require newer Node.js versions than previously supported.
  • Public modules are now individually listed in the package files and exports fields.
  • Removed ./package from the package exports field; the full package.json filename must be used in a require path.
  • Removed the package main index module; deep imports must be used.
  • Shortened public module deep import paths, removing the /public/.
  • The API is now ESM in .mjs files instead of CJS in .js files, accessible via import but not require.
  • Switched back to using React.createElement instead of the the new React JSX runtime.

Patch

  • Also run GitHub Actions CI with Node.js v17.
  • Simplified package scripts.
  • Removed the isobject dependency.
  • Refactored the useCacheEntryPrunePrevention React hook to avoid the React.useCallback React hook.
  • Avoid named imports from react and react-dom as they’re not proper Node.js ESM.
  • Removed conditionality on the Node.js global process.env.NODE_ENV.
  • Configured polyfilled globals in ESLint config for eslint-plugin-compat.
  • Fixed JSDoc grammar typos.
  • Reorganized the test file structure.
  • Corrected a test name.
  • Test the bundle sizes for public modules individually.
  • Use a new assertBundleSize function to assert module bundle size in tests:
    • Failure message contains details about the bundle size and how much the limit was exceeded.
    • Errors when the surplus is greater than 25% of the limit, suggesting the limit should be reduced.
    • Resolves the minified bundle and its gzipped size for debugging in tests.
  • Configured Prettier option singleQuote to the default, false.
  • Documentation tweaks.

15.0.0

Major

  • Updated the extract-files dependency to v11. This dependency is used by the function fetchOptionsGraphQL.

Patch

  • Updated dev dependencies.
  • Renamed imports in the test index module.
  • Amended the changelog entries for v11.0.0, v11.0.2, and v14.0.0.

14.0.0

Major

  • Updated Node.js support to ^12.20 || >= 14.13.
  • Updated dependencies, some of which require newer Node.js versions than were previously supported.
  • Replaced the the package.json exports field public subpath folder mapping (deprecated by Node.js) with a subpath pattern. Deep require paths within graphql-react/public/ must now include the .js file extension.
  • The tests are now ESM in .mjs files instead of CJS in .js files.

Patch

  • Updated GitHub Actions CI config to run tests with Node.js v12, v14, v16.
  • Simplified JSDoc related package scripts now that jsdoc-md v10+ automatically generates a Prettier formatted readme.
  • Added a package test:jsdoc script that checks the readme API docs are up to date with the source JSDoc.
  • Test the bundle size using esbuild instead of webpack and disposable-directory.
  • Increased the documented bundle size to “< 4 kB” to match that of esbuild instead of webpack.
  • Use the correct kB symbol instead of KB wherever bundle size is mentioned in the package description and readme.
  • Don’t destructure require from react to slightly improve the esbuild bundle size.
  • Use the .js file extension in internal require paths.
  • Updated the example Next.js app URL in the readme.
  • Readme tweaks.
  • The file changelog.md is no longer published.

13.0.0

Major

  • Updated Node.js version support to ^12.0.0 || >= 13.7.0.

  • Stopped supporting Internet Explorer.

  • Updated the react and react-dom peer dependencies to 16.14 - 17.

  • Use the new JSX runtime.

  • Reorganized the file structure and replaced the entire API:

    • Removed all of the previous public exports for the old API:
      • GraphQL
      • GraphQLContext
      • GraphQLProvider
      • hashObject
      • reportCacheErrors
      • useGraphQL
      • ssr
    • Added public exports for the new API, available as named imports from the index and as deep imports from graphql-react/public/ .js CJS modules:
      • Cache
      • CacheContext
      • HYDRATION_TIME_MS
      • HydrationTimeStampContext
      • Loading
      • LoadingCacheValue
      • LoadingContext
      • Provider
      • cacheDelete
      • cacheEntryDelete
      • cacheEntryPrune
      • cacheEntrySet
      • cacheEntryStale
      • cachePrune
      • cacheStale
      • fetchGraphQL
      • fetchOptionsGraphQL
      • useAutoAbortLoad
      • useAutoLoad
      • useCache
      • useCacheEntry
      • useCacheEntryPrunePrevention
      • useLoadGraphQL
      • useLoadOnDelete
      • useLoadOnMount
      • useLoadOnStale
      • useLoading
      • useLoadingEntry
      • useWaterfallLoad
    • The function waterfallRender from react-waterfall-render should now be used for server side rendering, fixing #57.
    • In addition to the previously required globals, consider polyfilling:

    The API for the cache (centered around a Cache instance provided in the CacheContext React context) is separated from the API for loading (centered around a Loading instance provided in the LoadingContext React context). Although the new loading system should work well for everyone, it could be totally avoided in an app that implements a custom alternative.

    Instead of using the old mitt dependency for events, the Cache and Loading classes extend the native EventTarget global available in modern browsers and Node.js; a powerful and familiar event system with zero bundle size cost.

    The new API avoids class methods that add to bundle size regardless if they are used, in favor of focused functions that can be imported to process instances as arguments. For example, one route in your app may only render a cache entry, while another may have a form that makes the global cache stale. If the functionality to make the cache stale was a Cache instance method, it would increase the bundle size for the entire app, whereas a function imported in the second route will only grow the bundle size for that route. Features can be added to the API over time without growing everyone’s bundles.

    There are now functions that can be imported to directly manipulate the cache. The functions cacheEntrySet and cacheEntryDelete update a particular entry, and cacheDelete deletes all cache.

    There is a new approach for dealing with stale cache. The function cacheEntryStale signals a single entry is stale, and cacheStale does the same for all entries (useful after a mutation). These functions don’t actually update cache entries; they simply dispatch cache entry stale events and it’s up to components to listen for this event and reload the cache entry in response, typically via the useLoadOnStale React hook.

    Cache entries that are not relevant to the current view can now be pruned on demand using the functions cacheEntryPrune for a single entry, or cachePrune for all entries, fixing #55. These functions work by dispatching cache entry prune events on the Cache instance, and for each event not cancelled by a listener with event.preventDefault(), the cache entry is deleted. The useCacheEntryPrunePrevention React hook can be used to automatically cancel pruning of a cache entry used in a component.

    Cache keys are now manually defined instead of automatically derived from fetch options hashes, fixing #56. This is easier to understand, is faster to render, and results in a smaller bundle size without the old fnv1a dependency for hashing.

    Instead of one useGraphQL React hook with complex options that all add to a component’s bundle size regardless if they are used, there are now several more focused React hooks that can be composed to do exactly the work required, fixing #53.

    The React hooks can be composed with custom ones to load and cache any type of data, not just GraphQL, using any method, not just fetch.

    The new loading system provides the ability to abort loading at any time, implemented using the native AbortController global available in modern browsers and Node.js, fixing #24. Many of the new React hooks leverage this for features such as automatically aborting loading a cache entry when the component loading it unmounts. The new API makes it trivially easy to build features as auto-suggest search inputs that abort the last loading on new input, or page queries that abort loading if the user abandons the route.

    While the new API may seem to have an intimidating number of public exports, the average Next.js app that queries and renders data from a GraphQL API will only use a few. For inspiration, see the readme “Examples” section.

  • Published modules now contain JSDoc comments, which might affect TypeScript projects.

Patch

  • Updated dependencies.
  • Removed Babel and related dependencies and config.
  • Updated GitHub Actions CI config:
    • Updated actions/checkout to v2.
    • Updated actions/setup-node to v2.
    • Don’t specify the CI environment variable as it’s set by default.
  • Stop using hard-rejection to detect unhandled Promise rejections in tests, as Node.js v15+ does this natively.
  • Test the bundle size manually using webpack v5, and remove size-limit related dev dependencies, config, and scripts.
  • Tweaked the package description.
  • Readme edits, including:
    • Updated the Relay and Apollo URLs.
    • Mention polyfilling any required globals in the “Setup” section.
    • Removed the “Usage” section.
    • Tweaked links in the “Support” section.
    • Removed the “Apollo comparison” section.

12.0.1

Patch

  • Updated the react and react-dom peer dependencies to 16.8 - 17.
  • Updated dependencies.
  • Also run GitHub Actions with Node.js v15.

12.0.0

Major

  • Concurrent GraphQL operations with the same cache key no longer share the first request.

  • The GraphQL instance property operations type has changed:

    - object<GraphQLCacheKey, Promise<GraphQLCacheValue>>
    + object<GraphQLCacheKey, Array<Promise<GraphQLCacheValue>>>

Patch

  • Updated dev dependencies.
  • Improved the test utility promisifyEvent function.
  • Test the the GraphQL instance method operate option reloadOnLoad in isolation.
  • Test better the order of the GraphQL instance method operate triggered events.
  • Refactored the GraphQL instance method operate to eliminate the GraphQL private instance method fetch and reduce the chance of race conditions in consumer code.
  • Reduced the number of promises created by the GraphQL instance method operate when the reloadOnLoad and reloadOnLoad options are false.
  • Added a code example for how to await all loading GraphQL operations.
  • Used consistent JSDoc types for promises that resolve void.
  • Tweaked JSDoc.
  • Tweaked changelog entries.

11.2.0

Minor

  • Added a new cacheKeyCreator option to the GraphQL instance method operate and the useGraphQL React hook.
  • The previously private hashObject function is now publicly exported.

Patch

  • Replaced Node.js deprecated notEqual assertions with notStrictEqual in tests.
  • Use the TypeError class instead of Error for relevant errors.

11.1.0

Minor

  • Allow React component displayName and propTypes to be removed in production builds, fixing #51.
  • Refactored the useGraphQL React hook to do less work for following renders if the operation and fetchOptionsOverride options are defined outside the component or memoized using the React.useMemo hook.
  • Memoize what the useGraphQL React hook returns for more efficient hook composition.
  • Added a new loadedCacheValue property to the GraphQL operation status object returned by the useGraphQL React hook. This allows cache for an earlier operation to be rendered while loading changes to the query, variables, or fetch options.

Patch

  • Updated dependencies.
  • Use coverage-node to enforce 100% code coverage for tests.
  • Increased the universal API size-limit from 3 KB to 3.5 KB.
  • Updated the useGraphQL React hook examples to use the GitHub GraphQL API.
  • Improved the useGraphQL React hook tests.
  • Improved documentation.

11.0.4

Patch

  • Clearly documented ways to import and require the package exports.

11.0.3

Patch

  • Updated the extract-files dependency to v9.0.0, and used its new deep require path.
  • Updated dev dependencies.
  • No longer test Node.js v13 in GitHub Actions CI.
  • Corrected the Browserslist query in the Babel config for the server API.
  • Write tests as CJS and no longer separately build and test ESM and CJS to simplify package scripts, Babel and ESLint config.
  • Removed the @babel/plugin-proposal-class-properties dev dependency and config, as @babel/preset-env has handed this via it’s shippedProposals options since v7.10.0.
  • Removed unnecessary .js file extensions from require paths.
  • Improved polyfilling globals in tests:
  • Removed a no longer necessary formdata-node workaround in graphqlFetchOptions tests.
  • Removed npm-debug.log from the .gitignore file as npm v4.2.0+ doesn’t create it in the current working directory.

11.0.2

Patch

  • Updated dependencies.
  • Simplified the GitHub Actions CI config with the npm install-test command.
  • Use Babel config overrides to ensure .js files are parsed as scripts, eliminating Babel interopRequireDefault helpers from transpilation output.
  • Updated Zeit/Vercel related URLs in documentation.
  • Updated the readme “Apollo comparison” section.

11.0.1

Patch

  • Updated Node.js support to ^10.17.0 || ^12.0.0 || >= 13.7.0. This is only a correction; the dependency updates with breaking changes happened in previous versions.
  • Updated dependencies.
  • Simplified JSX boolean props in tests.
  • Improved event documentation.
  • Fixed an incorrect reportCacheErrors JSDoc parameter type.
  • Updated EditorConfig.

11.0.0

Major

  • Added a package exports field to support native ESM in Node.js.
  • Some source and published files are now .js (CJS) instead of .mjs (ESM), so undocumented deep imports may no longer work. This approach avoids the dual package hazard.
  • Updated Node.js support from v10+ to 10 - 12 || >= 13.7 to reflect the package exports related breaking changes.

Patch

  • Updated dependencies.
  • Added a new babel-plugin-transform-runtime-file-extensions dev dependency to simplify Babel config.
  • Improved the package prepare:prettier and test:prettier scripts.
  • Reordered the package test:eslint script args for consistency with test:prettier.
  • Configured Prettier option semi to the default, true.
  • Reconfigured size-limit:
    • Separately test the universal and server only exports, without using unpublished size limit entry files that bloat the measured sizes.
    • Separately test the ESM and CJS exports.
    • Separately limit tests, with the universal ESM and CJS set to a 3 KB maximum size.
  • Removed redundant ESLint disable comments.
  • Also run GitHub Actions with Node.js v14.
  • Updated readme content.
  • Updated JSDoc code examples:
    • Prettier formatting.
    • Import React in examples containing JSX.
    • Use Node.js ESM compatible import specifiers.

10.0.0

Major

  • Updated Node.js support from v8.10+ to v10+.
  • Updated dependencies, some of which require Node.js v10+.
  • Replaced the tap dev dependency with test-director and hard-rejection, and refactored tests accordingly. This improves the dev experience and reduced the dev install size by ~75.5 MB.
  • Use ReactDOM.unstable_batchedUpdates in the useGraphQL React hook to reduce the number of renders when loading completes, fixing #38 via #42. Although react-dom was already a peer dependency, this is the first time it's being used in the client API; potentially a breaking change for atypical projects.

Patch

  • Updated tests for compatibility with updated dependencies.
  • Removed the object-assign dependency and several Babel dev dependencies after simplifying the Babel config.
  • Added a new babel-plugin-transform-require-extensions dev dependency and ensured ESM import specifiers in both source and published .mjs files contain file names with extensions, which are mandatory in the final Node.js ESM implementation. Published CJS .js files now also have file extensions in require paths.
  • Stop using husky and lint-staged.
  • Lint fixes for prettier v2.
  • Tidied Babel configs.
  • Ensure GitHub Actions run on pull request.
  • Use strict mode for scripts.
  • Readme “Apollo comparison” section corrections and tweaks.

9.1.0

Minor

  • Setup GitHub Sponsors funding:
    • Added .github/funding.yml to display a sponsor button in GitHub.
    • Added a package.json funding field to enable npm CLI funding features.

Patch

  • Updated dev dependencies.

9.0.0

Major

  • Updated Node.js support from v8.5+ to v8.10+, to match what the eslint dev dependency now supports. This is unlikely to be a breaking change for the published package.
  • The useGraphQL React hook loadOnMount, loadOnReload, and loadOnReset options now default to false instead of true. The loading related options are now all opt-in, which is easier to remember and simpler to configure for situations that previously required manual reversal of certain option defaults. It's also safer when working with mutations you don't want to accidentally load.

Patch

  • Updated dependencies.
  • Replaced the size-limit dev dependency with @size-limit/preset-small-lib.
  • Fixed the useGraphQL enabled option loadOnReload causing a load when the global GraphQL cache is reloaded even if there was no previously cached data to reload.
  • Tweaked the useGraphQL option loadOnReset documentation.
  • Removed package-lock.json from .gitignore and .prettierignore as it’s disabled in .npmrc anyway.
  • Removed redundant ESLint ignore comments.
  • Use GitHub Actions instead of Travis for CI.
  • Minor simplification in useGraphQL tests.
  • Documentation improvements, fixing #35:
    • Updated the project description with better phrasing that includes the bundle size.
    • Moved the readme “Apollo comparison” section to the end, and updated the “Bundle impact” subsection for the new Apollo React hooks API.
    • Added a basic example of the core API features working together to the “Examples” section, with tips commented.
    • Clarified that Opera Mini isn’t supported in the Browserslist queries and readme “Support” section.
    • Cleaner readme “API” section table of contents with “See” and “Examples” headings excluded, thanks to jsdoc-md v3.1.0.

8.3.0

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.

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

8.1.3

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.

8.1.2

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.

8.1.1

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.

8.1.0

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.

8.0.2

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.

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

8.0.0

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.

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

6.0.1

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.

6.0.0

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.

5.0.0

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.

4.2.0

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.

4.1.0

Minor

Patch

4.0.1

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.

4.0.0

Major

Patch

  • Updated dev dependencies.

3.0.0

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. By default webpack 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.

2.0.1

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.

2.0.0

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.

1.0.1

Patch

  • Updated dependencies.
  • Fixed accidental distribution code Prettier ignoring.
  • Replaced ava with tap for testing. Tests don't require a special CLI, no longer transpile on the fly, are faster and AVA no longer dictates the Babel version.
  • Tests run against the actual dist .mjs and .js files in native ESM (--experimental-modules) and CJS environments.
  • Ignore object-assign for bundle size tests as it’s a React dependency and tighten the allowed bundle size from 4 KB to 3 KB.
  • Updated Babel config:
    • Use babel.config.js instead of .babelrc.js.
    • Renamed the ESM environment variable to BABEL_ESM to be more specific.
  • Improved package.json scripts:
    • Leveraged npm-run-all more for parallelism and reduced noise.
    • Removed linting fix scripts.
    • Linting included in the test script. Travis CI will fail PR's with lint errors.
    • Custom watch script.
    • No longer use cross-env; contributors with Windows may setup and use a Bash shell.
  • Improved ESLint config:
    • Use eslint-config-env.
    • Removed redundant eslint-plugin-ava dev dependency and config.
    • Undo overriding ESLint ignoring dotfiles by default as there are none now.
  • Moved the example project to a separate repo.
  • Better readme logo alt text.

1.0.0

Major

  • Capitalized the fetch options Accept header for display consistency in tools such as the Chrome network inspector and to better support case-sensitive systems, even though HTTP headers are supposed to be case-insensitive.

Patch

  • Updated dependencies.
  • Pinned @babel dev dependencies to match new AVA requirements.
  • Use eslint-config-prettier.
  • Readme example link goes to the example project directory instead of the readme file.
  • Test and example updates:
  • Test updates:
    • Removed apollo-upload-server as there are no upload tests yet.
    • Removed get-port as not providing a port to app.listen has the same effect.
  • Example updates:

1.0.0-alpha.5

Major

Patch

  • Updated dependencies.
  • Example updates:
    • Valid length app manifest short_name.
    • Added <html> lang attribute.
    • Added Twitter card meta tags.

1.0.0-alpha.4

Minor

  • Added a fetchError Query render function argument, enabling graceful caching and handling of errors in situations such as when a global fetch API is unavailable or a relative URL is used on the sever.

Patch

1.0.0-alpha.3

Minor

  • Support the legacy React context API, fixing #7.

Patch

1.0.0-alpha.2

Major

  • Removed the Promise polyfill; consumers can polyfill as required for optimal bundle size. Required polyfills are documented in the readme.

Minor

Patch

  • Updated dependencies.
  • Updated ESLint config:
    • parserOptions is unnecessary when using babel-eslint.
    • Enabled prefer-destructuring rule.

1.0.0-alpha.1

Major

  • Updated Node.js support to v7.6+.
  • Renamed GraphQLProvider and GraphQLConsumer to Provider and Consumer.
  • No longer exporting GraphQLQuery.
  • Swapped the GraphQLQuery and Query names.
  • Removed GraphQLMutation component; GraphQLQuery can be used for both queries and mutations.
  • GraphQLQuery component loadOnMount and loadOnReset props now default to false:
    • Opt-in is safer for mutations.
    • Removing static defaultProps reduces bundle size.
    • Nicer valueless boolean props (<GraphQLQuery /> and <GraphQLQuery loadOnReset /> vs <GraphQLQuery loadOnReset={false} /> and <GraphQLQuery loadOnReset={true} />.
  • The GraphQL query instance method now accepts an options object.
  • New approach to configuring GraphQL request fetch options:
    • Removed the GraphQL constructor requestOptions option.
    • The Query component now has a fetchOptionsOverride prop, allowing components to easily query any GraphQL API. Consumers may export an override function tailored for each API in one place to make things DRY.
    • The Next.js example app has been updated to demo the new API using the external GraphQL Pokémon API.

Minor

  • New preload API for server side rendering, fixing #2.
  • The Query component resetOnLoad prop doesn’t cause cache for the request that triggered a reset to delete, allowing simultaneous use with loadOnReset. Fixes #3.
  • The GraphQL reset instance method now accepts a fetch options hash to exempt a request from cache deletion.

Patch

  • Updated dependencies.
  • Fetch errors when a request could not be sent at all (e.g. a relative URL can’t be used for server side rendering) are uncaught instead of incorrectly cached as a parseError.
  • Simplified the JSDoc script, now that Documentation.js handles .mjs.
  • Prevent lib or example updates from triggering tests in watch mode.
  • Fixed the example setup script and made graphql-react a published dependency, via #1.
  • Commented GraphQL template literals for editor syntax highlighting.
  • Configured Travis and added a build status readme badge.
  • Improved API documentation.

0.1.0

Initial release.