- Updated the
react-waterfall-renderdependency to v5.
- Updated the
extract-filesdependency to v13. - Updated dev dependencies.
- Use the
node:URL scheme for Node.js builtin module imports in tests. - Updated ESLint config.
- Replaced TypeScript
Recordtypes 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.
- Updated Node.js support to
^14.17.0 || ^16.0.0 || >= 18.0.0.
- Updated the
reactpeer dependency to16.14 - 18. - Removed the redundant
react-dompeer dependency. - Updated dependencies.
- Removed the
@testing-library/react-hooksdev dependency and rewrote React hook tests usingreact-test-renderer, a new test utility functioncreateReactTestRenderer, and a custom React componentReactHookTest. - Removed the
fetch-blobandformdata-nodedev dependencies. Instead,FileandFormDataare imported fromnode-fetch. - Updated
jsconfig.json:- Set
compilerOptions.maxNodeModuleJsDepthto10. - Set
compilerOptions.moduletonodenext.
- Set
- Updated GitHub Actions CI config:
- Run tests with Node.js v14, v16, v18.
- Removed the now redundant
not IE > 0from the Browserslist query. - Updated
react-dom/serverimports in tests to suit React v18. - Fixed the
fetchGraphQLtest with the globalfetchAPI unavailable for new versions of Node.js that have thefetchglobal. - Use
globalThisinstead ofglobalin tests. - Use
ReactTestRendererinstead ofReactDOMServer.renderToStaticMarkupin some React context related tests. - Removed some unnecessary JSDoc comments in tests.
- Fixed some JSDoc links.
- Revamped the readme:
- Removed the badges.
- Updated the “Examples” section to reflect the
graphql-reactexamples repo migration from Node.js, Next.js, and Vercel to Deno, Ruck, and Fly.io. - Added information about Deno, import maps, TypeScript config, and optimal JavaScript module design.
- Renamed the type
FetchGraphQLResultErrorstoFetchGraphQLResultErrorinfetchGraphQL.mjs.
- Added the new type
FetchGraphQLResultErrorLoadingtofetchGraphQL.mjscontaining the GraphQL result error types related to loading that are generated on the client, not the GraphQL server.
- 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
Deferredclass used in tests.
- Updated the
extract-filesdependency. - Updated the
react-waterfall-renderdependency. - Implemented TypeScript types via JSDoc comments, fixing #6.
- Updated dev dependencies.
- Sorted the contents of the package
filesandexportsfields. - Removed the
jsdoc-mddev dependency and the packagedocs-updateanddocs-checkscripts, replacing the readme “API” section with a manually written “Exports” section. - Check TypeScript types via a new package
typesscript. - Replaced the
formdata-nodedev dependency withformdata-polyfillandfetch-blob. - Updated GraphQL spec URLs in JSDoc and regular comments.
- Readme tweaks.
- Added a
license.mdMIT License file, fixing #54.
- 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
filesandexportsfields. - Removed
./packagefrom the packageexportsfield; the fullpackage.jsonfilename must be used in arequirepath. - 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
.mjsfiles instead of CJS in.jsfiles, accessible viaimportbut notrequire. - Switched back to using
React.createElementinstead of the the new React JSX runtime.
- Also run GitHub Actions CI with Node.js v17.
- Simplified package scripts.
- Removed the
isobjectdependency. - Refactored the
useCacheEntryPrunePreventionReact hook to avoid theReact.useCallbackReact hook. - Avoid named imports from
reactandreact-domas 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
assertBundleSizefunction 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
singleQuoteto the default,false. - Documentation tweaks.
- Updated the
extract-filesdependency to v11. This dependency is used by the functionfetchOptionsGraphQL.
- 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.
- 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.jsonexportsfield public subpath folder mapping (deprecated by Node.js) with a subpath pattern. Deeprequirepaths withingraphql-react/public/must now include the.jsfile extension. - The tests are now ESM in
.mjsfiles instead of CJS in.jsfiles.
- Updated GitHub Actions CI config to run tests with Node.js v12, v14, v16.
- Simplified JSDoc related package scripts now that
jsdoc-mdv10+ automatically generates a Prettier formatted readme. - Added a package
test:jsdocscript that checks the readme API docs are up to date with the source JSDoc. - Test the bundle size using
esbuildinstead ofwebpackanddisposable-directory. - Increased the documented bundle size to “< 4 kB” to match that of
esbuildinstead ofwebpack. - Use the correct
kBsymbol instead ofKBwherever bundle size is mentioned in the package description and readme. - Don’t destructure
requirefromreactto slightly improve theesbuildbundle size. - Use the
.jsfile extension in internalrequirepaths. - Updated the example Next.js app URL in the readme.
- Readme tweaks.
- The file
changelog.mdis no longer published.
-
Updated Node.js version support to
^12.0.0 || >= 13.7.0. -
Stopped supporting Internet Explorer.
-
Updated the
reactandreact-dompeer dependencies to16.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:
GraphQLGraphQLContextGraphQLProviderhashObjectreportCacheErrorsuseGraphQLssr
- Added public exports for the new API, available as named imports from the index and as deep imports from
graphql-react/public/.jsCJS modules:CacheCacheContextHYDRATION_TIME_MSHydrationTimeStampContextLoadingLoadingCacheValueLoadingContextProvidercacheDeletecacheEntryDeletecacheEntryPrunecacheEntrySetcacheEntryStalecachePrunecacheStalefetchGraphQLfetchOptionsGraphQLuseAutoAbortLoaduseAutoLoaduseCacheuseCacheEntryuseCacheEntryPrunePreventionuseLoadGraphQLuseLoadOnDeleteuseLoadOnMountuseLoadOnStaleuseLoadinguseLoadingEntryuseWaterfallLoad
- The function
waterfallRenderfromreact-waterfall-rendershould 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
Cacheinstance provided in theCacheContextReact context) is separated from the API for loading (centered around aLoadinginstance provided in theLoadingContextReact 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
mittdependency for events, theCacheandLoadingclasses extend the nativeEventTargetglobal 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
Cacheinstance 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
cacheEntrySetandcacheEntryDeleteupdate a particular entry, andcacheDeletedeletes all cache.There is a new approach for dealing with stale cache. The function
cacheEntryStalesignals a single entry is stale, andcacheStaledoes 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 theuseLoadOnStaleReact hook.Cache entries that are not relevant to the current view can now be pruned on demand using the functions
cacheEntryPrunefor a single entry, orcachePrunefor all entries, fixing #55. These functions work by dispatching cache entry prune events on theCacheinstance, and for each event not cancelled by a listener withevent.preventDefault(), the cache entry is deleted. TheuseCacheEntryPrunePreventionReact 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
fetchoptions hashes, fixing #56. This is easier to understand, is faster to render, and results in a smaller bundle size without the oldfnv1adependency for hashing.Instead of one
useGraphQLReact 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
AbortControllerglobal 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.
- Removed all of the previous public exports for the old API:
-
Published modules now contain JSDoc comments, which might affect TypeScript projects.
- Updated dependencies.
- Removed Babel and related dependencies and config.
- Updated GitHub Actions CI config:
- Updated
actions/checkoutto v2. - Updated
actions/setup-nodeto v2. - Don’t specify the
CIenvironment variable as it’s set by default.
- Updated
- Stop using
hard-rejectionto detect unhandledPromiserejections in tests, as Node.js v15+ does this natively. - Test the bundle size manually using
webpackv5, and removesize-limitrelated 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.
- Updated the
reactandreact-dompeer dependencies to16.8 - 17. - Updated dependencies.
- Also run GitHub Actions with Node.js v15.
-
Concurrent GraphQL operations with the same cache key no longer share the first request.
-
The
GraphQLinstance propertyoperationstype has changed:- object<GraphQLCacheKey, Promise<GraphQLCacheValue>> + object<GraphQLCacheKey, Array<Promise<GraphQLCacheValue>>>
- Updated dev dependencies.
- Improved the test utility
promisifyEventfunction. - Test the the
GraphQLinstance methodoperateoptionreloadOnLoadin isolation. - Test better the order of the
GraphQLinstance methodoperatetriggered events. - Refactored the
GraphQLinstance methodoperateto eliminate theGraphQLprivate instance methodfetchand reduce the chance of race conditions in consumer code. - Reduced the number of promises created by the
GraphQLinstance methodoperatewhen thereloadOnLoadandreloadOnLoadoptions arefalse. - 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.
- Added a new
cacheKeyCreatoroption to theGraphQLinstance methodoperateand theuseGraphQLReact hook. - The previously private
hashObjectfunction is now publicly exported.
- Replaced Node.js deprecated
notEqualassertions withnotStrictEqualin tests. - Use the
TypeErrorclass instead ofErrorfor relevant errors.
- Allow React component
displayNameandpropTypesto be removed in production builds, fixing #51. - Refactored the
useGraphQLReact hook to do less work for following renders if theoperationandfetchOptionsOverrideoptions are defined outside the component or memoized using theReact.useMemohook. - Memoize what the
useGraphQLReact hook returns for more efficient hook composition. - Added a new
loadedCacheValueproperty to the GraphQL operation status object returned by theuseGraphQLReact hook. This allows cache for an earlier operation to be rendered while loading changes to the query, variables, orfetchoptions.
- Updated dependencies.
- Use
coverage-nodeto enforce 100% code coverage for tests. - Increased the universal API size-limit from 3 KB to 3.5 KB.
- Updated the
useGraphQLReact hook examples to use the GitHub GraphQL API. - Improved the
useGraphQLReact hook tests. - Improved documentation.
- Clearly documented ways to
importandrequirethe package exports.
- Updated the
extract-filesdependency to v9.0.0, and used its new deeprequirepath. - 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-propertiesdev dependency and config, as@babel/preset-envhas handed this via it’sshippedProposalsoptions since v7.10.0. - Removed unnecessary
.jsfile extensions fromrequirepaths. - Improved polyfilling globals in tests:
- Use
revertable-globalsto define globals per-test. - Use
node-fetchv3 instead ofcross-fetch.
- Use
- Removed a no longer necessary
formdata-nodeworkaround ingraphqlFetchOptionstests. - Removed
npm-debug.logfrom the.gitignorefile as npm v4.2.0+ doesn’t create it in the current working directory.
- Updated dependencies.
- Simplified the GitHub Actions CI config with the
npm install-testcommand. - Use Babel config
overridesto ensure.jsfiles are parsed as scripts, eliminating BabelinteropRequireDefaulthelpers from transpilation output. - Updated Zeit/Vercel related URLs in documentation.
- Updated the readme “Apollo comparison” section.
- 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
reportCacheErrorsJSDoc parameter type. - Updated EditorConfig.
- Added a package
exportsfield 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.7to reflect the packageexportsrelated breaking changes.
- Updated dependencies.
- Added a new
babel-plugin-transform-runtime-file-extensionsdev dependency to simplify Babel config. - Improved the package
prepare:prettierandtest:prettierscripts. - Reordered the package
test:eslintscript args for consistency withtest:prettier. - Configured Prettier option
semito 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.
- Updated Node.js support from v8.10+ to v10+.
- Updated dependencies, some of which require Node.js v10+.
- Replaced the
tapdev dependency withtest-directorandhard-rejection, and refactored tests accordingly. This improves the dev experience and reduced the dev install size by ~75.5 MB. - Use
ReactDOM.unstable_batchedUpdatesin theuseGraphQLReact hook to reduce the number of renders when loading completes, fixing #38 via #42. Althoughreact-domwas already a peer dependency, this is the first time it's being used in the client API; potentially a breaking change for atypical projects.
- Updated tests for compatibility with updated dependencies.
- Removed the
object-assigndependency and several Babel dev dependencies after simplifying the Babel config. - Added a new
babel-plugin-transform-require-extensionsdev dependency and ensured ESM import specifiers in both source and published.mjsfiles contain file names with extensions, which are mandatory in the final Node.js ESM implementation. Published CJS.jsfiles now also have file extensions inrequirepaths. - Stop using
huskyandlint-staged. - Lint fixes for
prettierv2. - Tidied Babel configs.
- Ensure GitHub Actions run on pull request.
- Use strict mode for scripts.
- Readme “Apollo comparison” section corrections and tweaks.
- Setup GitHub Sponsors funding:
- Added
.github/funding.ymlto display a sponsor button in GitHub. - Added a
package.jsonfundingfield to enable npm CLI funding features.
- Added
- Updated dev dependencies.
- Updated Node.js support from v8.5+ to v8.10+, to match what the
eslintdev dependency now supports. This is unlikely to be a breaking change for the published package. - The
useGraphQLReact hookloadOnMount,loadOnReload, andloadOnResetoptions now default tofalseinstead oftrue. 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.
- Updated dependencies.
- Replaced the
size-limitdev dependency with@size-limit/preset-small-lib. - Fixed the
useGraphQLenabled optionloadOnReloadcausing a load when the globalGraphQLcache is reloaded even if there was no previously cached data to reload. - Tweaked the
useGraphQLoptionloadOnResetdocumentation. - Removed
package-lock.jsonfrom.gitignoreand.prettierignoreas it’s disabled in.npmrcanyway. - Removed redundant ESLint ignore comments.
- Use GitHub Actions instead of Travis for CI.
- Minor simplification in
useGraphQLtests. - 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-mdv3.1.0.
- Added a
responseproperty to theGraphQLinstancecacheevent payload, containing the originalfetchResponseinstance thecacheValuewas derived from.
- Updated dependencies.
- Increased the post SSR hydration time from 500 to 1000 milliseconds, closing #37.
- Added a
useGraphQLoptions guide for common situations. - Test the
GraphQLinstance methodoperatewith bothreloadOnLoadandresetOnLoadoptionstrue. - Use string
FormDatafield names, as someFormDatapolyfills 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.
- Added a new
GraphQLProvidercomponent that prevents unnecessary loading on the client after SSR, fixing #4. This component should be used instead of usingGraphQLContext.Providerdirectly. The old way still works, but with the old behavior.
- Updated dev dependencies.
- Updated the
GraphQLContext.Consumerexample to use React hooks.
- Updated dependencies.
- Adopted the new
size-limitconfig file name. - Slightly faster
useGraphQLrender error when optionsreloadOnLoadandresetOnLoadare bothtrue. - Use a ref instead of a variable in
useGraphQLto track mounted status for cache related callbacks. - Document the
GraphQLinstance methodoperateoptionreloadOnLoad. - Minor readme quotes consistency tweak.
- Updated dependencies.
- Updated
useGraphQLto useuseCallbackand added hook dependency arrays, to fix a recently appearingreact-hooks/exhaustive-depslint error and hopefully reduce render work. - Reduced the size of the published
package.jsonby 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.
- Updated a dev dependency.
- Removed redundant
useGraphQLinternaluseEffectReact hook second arguments. - Fixed “Can't perform a React state update on an unmounted component” warnings if the component using the
useGraphQLReact hook is unmounted soon after anGraphQLinstance event such asresetis emitted.
- Added the
GraphQLinstance methodreloadwhich fires areloadevent signaling that GraphQL cache subscribers such as theuseGraphQLReact hook should reload their GraphQL operation, fixing #26. - Added the
useGraphQLReact hookreloadOnLoadoption.
- Updated dependencies.
- More reliable
useGraphQLReact hookloadOnMountoption implementation that fixes ESLintreact-hooks/exhaustive-depsrule errors. - Use
functioninstead ofconstdeclarations in places to simplify transpiled output. GraphQL.reset()test name typo fix.- Added tests for the
useGraphQLReact hookreloadOnLoadandresetOnLoadoptions. - 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
GraphQLinstance event documentation.
- Updated dev dependencies.
useGraphQLReact hook bug fix for when arguments change after the initial render and theloadfunction is called:loadingandcacheValuenow update correctly after the operation loads.
- Updated dev dependencies.
useGraphQLReact hook bug fixes for when arguments change after the initial render:- Changes that cause the
cacheKeyto change trigger a reload if theloadOnMountoption istrue, fixing #23. - Fixed stale operation status properties being returned.
- Changes that cause the
- Use
react-test-rendererto testuseGraphQLwith a lot more detail. - Capitalized the
Reactnamespace inuseGraphQL. - Improved
hashObject()tests.
-
Updated the
reactandreact-dompeer dependencies to^16.8.0. -
Removed the
Querycomponent. -
No longer exporting
ProviderandConsumer; nowGraphQLContextis exported. -
The
GraphQLinstance methodqueryhas been renamedoperate. -
The
GraphQLconstructor no longer has thelogErrorsoption, and GraphQL operation errors are no longer console logged by default. -
The
ssrfunction is now exported fromgraphql-react/serverinstead ofgraphql-react/lib/ssr. -
The
ssrfunction is now implemented usingasync/awaitsyntax. -
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
fetchoptionsbodyis aFormDatainstance has been improved. Previously they would overwrite each other in the cache even if the GraphQL operations were different, depending if theFormDatainstance was native or from a polyfill that could be JSON serialized.There is still room to improve as
FormDatafield values that areFileorBlobinstances don’t influence the cache key hashing. -
GraphQLevent properties have been renamed or added:- The
fetchevent propertyfetchOptionsHashwas renamedcacheKey, and the propertycachewas renamedcacheValuePromise. - The
cacheevent propertyfetchOptionsHashwas renamedcacheKey, and the propertycacheValuewas added. - The
resetevent propertyexceptFetchOptionsHashwas renamedexceptCacheKey.
- The
- Added the
useGraphQLReact hook, which assumes the role of the removedQuerycomponent. - Documented the
GraphQLonandoffmethods for managing event listeners. - Added the
reportCacheErrorsfunction, aGraphQLcacheevent handler that can be setup to report GraphQL operation errors viaconsole.log().
- Updated dev dependencies.
- Updated the package description and keywords.
- Simplified the
prepublishOnlyscript. - Use the
tapCLI 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
testscript 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.
- Removed the
preloadfunction. It was not going to work with React hooks. - Added the
react-dompeer dependency. - Reorganized file structure. This is only a breaking change for consumers that were not importing the documented way (via the
mainpackage entry).
- Added a
ssrfunction, which is for server use only and is React hooks ready. It is simpler and more future-proof than the removedpreloadfunction as it leveragesReactDOMServerfor rendering. GraphQLnow emits acachepromise in thefetchevent payload. These events are undocumented, so this could be considered an internal change.
- Updated dependencies.
- Handle exceptions outside tests (see tapjs/node-tap#463 (comment)).
- Added a
ReactNodeJSDoc type, replacingReactElementtypes. - Removed tests made redundant by the removal of the
preloadfunction. - Document the official Next.js example.
- Improved documentation.
- Updated dev dependencies.
- Removed the
watchdev dependency andwatchpackage script. preloadnow properly catches render errors nested underQuerycomponents.preloadnow supports class components that don’t call their base constructor withprops, fixing #17.- Fixed a prop type warning in one of the tests.
- Fixed example code typos in the readme “Usage” section.
- Fixed incorrect
graphQLErrorsJSDoc type.
- Made
preloadreject upon render errors instead of throwing.
- Made
Querycomponent throw a helpful render error if the GraphQL context is missing.
- Updated dev dependencies.
- Improved
size-limittests:- Drop the CJS entrypoint; modern bundlers don’t use it and nested module imports revert resolve ESM anyway.
- Ignore
prop-typessince 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.
- Updated the
extract-filesdependency 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.
- Updated dependencies.
- Removed a redundant
.prettierignoreentry. - Added tests for the internal
graphqlFetchOptionsfunction.
- Added a new
GraphQLconstructor optionlogErrors(defaulttrue) and instance property, controlling if GraphQL request errors should be console logged for easy debugging.
- Updated dependencies.
- Refactored
GraphQLstatic 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.
- Support more browsers by changing the Browserslist query from
> 1%to> 0.5%, not dead.
- Updated dependencies.
- Fix Babel not reading from the package
browserslistfield due to a sneaky@babel/preset-envbreaking change. - Add back the bundle size test accidentally removed in v4.0.1.
- Fixed
preloadforproductionNODE_ENV, fixing #11 and #12. preloadnow scopes context under providers.- Removed redundant uses of
thisin the internalGraphQLQuerycomponent constructor. - Test the library with undefined and
productionNODE_ENV.
- Updated the
reactpeer dependency to^16.6.0. - Fixed
preloadbroken due to the React v16.6.0 context API change, fixing #11.
- Updated dev dependencies.
- The
Query(and the internalGraphQLQuery) component take anoperationprop instead of separatevariablesandqueryprops. This makes the implementation a little more elegant, is more consistent with theGraphQL.queryAPI and allows sending custom GraphQL operation fields. - New internal event system, fixing #10. Now the
loadingparameter ofQuerycomponent render functions change when identical requests are loaded elsewhere in the app.
- Improved
ProviderandConsumercomponent display names in React dev tools:Context.Provider→GraphQLContext.ProviderContext.Consumer→GraphQLContext.Consumer
- Updated dependencies.
- Updated package scripts and config for the new
huskyversion. - Removed the package
modulefield. By default webpack resolves extensionless paths the same way Node.js in--experimental-modulesmode does;.mjsfiles are preferred. Tools misconfigured or unable to resolve.mjscan get confused whenmodulepoints to an.mjsESM file and they attempt to resolve named imports from.jsCJS files. - Renamed the
OperationtypeGraphQLOperation. - Use jsDelivr for the readme logo instead of RawGit as they are shutting down.
- Updated dependencies.
- Remove the
GraphQLQuerycomponent from API documentation as it used internally and is not exported. - Regenerated the readme API docs using the latest
jsdoc-mdversion. - Added a new “Usage” readme section.
- Fixed a link in the readme.
- Fixed example GraphQL query typos.
- Updated Node.js support from v7.6+ to v8.5+.
- Use package
preparescript to support installation via Git (e.g.npm install jaydenseric/graphql-react). - Use
@babel/plugin-transform-runtimeand@babel/runtimeto make runtime helpers more DRY. Bundle size savings will manifest once more packages import the same helpers. - Package marked side-effect free for bundlers and tree-shaking.
- Updated dependencies.
- Removed the
rimrafdev dependency in favour of a nativerm -rfpackage clean script. Leaner and faster; we only support *nix for contributing anyway. - Fixed new Prettier lint errors and removed the
fake-tagdev dependency now that Prettier can format template literals tagged with/* GraphQL */. - Stopped using
npm-run-allfor package scripts to reduce complexity and bugs. - Compact package
repositoryfield. - Added more package tags.
- Lint
.ymlfiles. - Test with
graphql-api-koainstead ofexpress-graphql. - Fixed test snapshot consistency between Node.js versions (see tapjs/node-tap#450).
- Use
jsdoc-mdinstead ofdocumentationto 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
masterbranch. - Removed the licence badge. The licence can be found in
package.jsonand rarely changes. - Removed the Github issues and stars badges. The readme is most viewed on Github anyway.
- Use Badgen for the npm version badge.
- Used the more reliable build status badge provided by Travis, configured to only track
- Updated dependencies.
- Fixed accidental distribution code Prettier ignoring.
- Replaced
avawithtapfor 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
.mjsand.jsfiles in native ESM (--experimental-modules) and CJS environments. - Ignore
object-assignfor 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.jsinstead of.babelrc.js. - Renamed the
ESMenvironment variable toBABEL_ESMto be more specific.
- Use
- Improved
package.jsonscripts:- Leveraged
npm-run-allmore for parallelism and reduced noise. - Removed linting fix scripts.
- Linting included in the
testscript. 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.
- Leveraged
- Improved ESLint config:
- Use eslint-config-env.
- Removed redundant
eslint-plugin-avadev 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.
- Capitalized the fetch options
Acceptheader 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.
- Updated dependencies.
- Pinned
@babeldev 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:
- Use
fake-tagfor GraphQL template literals due to prettier/prettier#4360. - Use
expressinstead of Koa packages. - Use
express-graphqlinstead of Apollo packages.
- Use
- Test updates:
- Removed
apollo-upload-serveras there are no upload tests yet. - Removed
get-portas not providing a port toapp.listenhas the same effect.
- Removed
- Example updates:
- Stop using
esmdue to graphql/express-graphql#425. - Enabled GraphiQL and added a link to it on the homepage.
- Stop using
- Updated the
reactpeer dependency to^16.3.1. - Fixed
preloadbroken due to the React v16.3.1 context API change.
- Updated dependencies.
- Example updates:
- Valid length app manifest
short_name. - Added
<html>langattribute. - Added Twitter card meta tags.
- Valid length app manifest
- Added a
fetchErrorQueryrender function argument, enabling graceful caching and handling of errors in situations such as when a globalfetchAPI is unavailable or a relative URL is used on the sever.
- Updated dependencies.
- Replaced
isomorphic-unfetchwith the more updatedcross-fetch. - Use
.prettierignoreto deferpackage.jsonformatting to npm. - Improved the example web app and deployed it to graphql-react.now.sh.
- Support the legacy React context API, fixing #7.
- Use
eslint-plugin-ava.
- Removed the
Promisepolyfill; consumers can polyfill as required for optimal bundle size. Required polyfills are documented in the readme.
- Significantly reduced the bundle size to < 4 KB by simplifying Babel helpers and reusing the
object-assignReact dependency withbabel-plugin-transform-replace-object-assign.
- Updated dependencies.
- Updated ESLint config:
parserOptionsis unnecessary when usingbabel-eslint.- Enabled
prefer-destructuringrule.
- Updated Node.js support to v7.6+.
- Renamed
GraphQLProviderandGraphQLConsumertoProviderandConsumer. - No longer exporting
GraphQLQuery. - Swapped the
GraphQLQueryandQuerynames. - Removed
GraphQLMutationcomponent;GraphQLQuerycan be used for both queries and mutations. GraphQLQuerycomponentloadOnMountandloadOnResetprops now default tofalse:- Opt-in is safer for mutations.
- Removing
static defaultPropsreduces bundle size. - Nicer valueless boolean props (
<GraphQLQuery />and<GraphQLQuery loadOnReset />vs<GraphQLQuery loadOnReset={false} />and<GraphQLQuery loadOnReset={true} />.
- The
GraphQLqueryinstance method now accepts an options object. - New approach to configuring GraphQL request fetch options:
- Removed the
GraphQLconstructorrequestOptionsoption. - The
Querycomponent now has afetchOptionsOverrideprop, 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.
- Removed the
- New
preloadAPI for server side rendering, fixing #2. - The
QuerycomponentresetOnLoadprop doesn’t cause cache for the request that triggered a reset to delete, allowing simultaneous use withloadOnReset. Fixes #3. - The
GraphQLresetinstance method now accepts a fetch options hash to exempt a request from cache deletion.
- 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-reacta published dependency, via #1. - Commented GraphQL template literals for editor syntax highlighting.
- Configured Travis and added a build status readme badge.
- Improved API documentation.
Initial release.