UNPKG

41.1 kBMarkdownView Raw
1# graphql-react changelog
2
3## 13.0.0
4
5### Major
6
7- Updated Node.js version support to `^12.0.0 || >= 13.7.0`.
8- Stopped supporting Internet Explorer.
9- Updated the [`react`](https://npm.im/react) and [`react-dom`](https://npm.im/react-dom) peer dependencies to `16.14 - 17`.
10- Use [the new JSX runtime](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html).
11- Reorganized the file structure and replaced the entire API:
12
13 - Removed all of the previous public exports for the old API:
14 - `GraphQL`
15 - `GraphQLContext`
16 - `GraphQLProvider`
17 - `hashObject`
18 - `reportCacheErrors`
19 - `useGraphQL`
20 - `ssr`
21 - 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:
22 - `Cache`
23 - `CacheContext`
24 - `HYDRATION_TIME_MS`
25 - `HydrationTimeStampContext`
26 - `Loading`
27 - `LoadingCacheValue`
28 - `LoadingContext`
29 - `Provider`
30 - `cacheDelete`
31 - `cacheEntryDelete`
32 - `cacheEntryPrune`
33 - `cacheEntrySet`
34 - `cacheEntryStale`
35 - `cachePrune`
36 - `cacheStale`
37 - `fetchGraphQL`
38 - `fetchOptionsGraphQL`
39 - `useAutoAbortLoad`
40 - `useAutoLoad`
41 - `useCache`
42 - `useCacheEntry`
43 - `useCacheEntryPrunePrevention`
44 - `useLoadGraphQL`
45 - `useLoadOnDelete`
46 - `useLoadOnMount`
47 - `useLoadOnStale`
48 - `useLoading`
49 - `useLoadingEntry`
50 - `useWaterfallLoad`
51 - The [`waterfallRender`](https://github.com/jaydenseric/react-waterfall-render#function-waterfallrender) function from [`react-waterfall-render`](https://npm.im/react-waterfall-render) should now be used for server side rendering, fixing [#57](https://github.com/jaydenseric/graphql-react/issues/57).
52 - In addition to the previously required globals, consider polyfilling:
53 - [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController)
54 - [`CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent)
55 - [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event)
56 - [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)
57 - [`performance`](https://developer.mozilla.org/en-US/docs/Web/API/Window/performance)
58
59 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.
60
61 Instead of using the old [`mitt`](https://npm.im/mitt) dependency for events, the `Cache` and `Loading` classes extend the native [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) global available in modern browsers and Node.js; a powerful and familiar event system with zero bundle size cost.
62
63 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.
64
65 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.
66
67 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.
68
69 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](https://github.com/jaydenseric/graphql-react/issues/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.
70
71 Cache keys are now manually defined instead of automatically derived from `fetch` options hashes, fixing [#56](https://github.com/jaydenseric/graphql-react/issues/56). This is easier to understand, is faster to render, and results in a smaller bundle size without the old [`fnv1a`](https://npm.im/fnv1a) dependency for hashing.
72
73 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](https://github.com/jaydenseric/graphql-react/issues/53).
74
75 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`.
76
77 The new loading system provides the ability to abort loading at any time, implemented using the native [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) global available in modern browsers and Node.js, fixing [#24](https://github.com/jaydenseric/graphql-react/issues/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.
78
79 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.
80
81- Published modules now contain JSDoc comments, which might affect TypeScript projects.
82
83### Patch
84
85- Updated dependencies.
86- Removed Babel and related dependencies and config.
87- Updated GitHub Actions CI config:
88 - Updated `actions/checkout` to v2.
89 - Updated `actions/setup-node` to v2.
90 - Don’t specify the `CI` environment variable as it’s set by default.
91- Stop using [`hard-rejection`](https://npm.im/hard-rejection) to detect unhandled `Promise` rejections in tests, as Node.js v15+ does this natively.
92- Test the bundle size manually using [`webpack`](https://npm.im/webpack) v5, and remove [`size-limit`](https://npm.im/size-limit) related dev dependencies, config, and scripts.
93- Tweaked the package description.
94- Readme edits, including:
95 - Updated the Relay and Apollo URLs.
96 - Mention polyfilling any required globals in the “Setup” section.
97 - Removed the “Usage” section.
98 - Tweaked links in the “Support” section.
99 - Removed the “Apollo comparison” section.
100
101## 12.0.1
102
103### Patch
104
105- Updated the [`react`](https://npm.im/react) and [`react-dom`](https://npm.im/react-dom) peer dependencies to `16.8 - 17`.
106- Updated dependencies.
107- Also run GitHub Actions with Node.js v15.
108
109## 12.0.0
110
111### Major
112
113- Concurrent GraphQL operations with the same cache key no longer share the first request.
114- The `GraphQL` instance property `operations` type has changed:
115
116 ```diff
117 - object<GraphQLCacheKey, Promise<GraphQLCacheValue>>
118 + object<GraphQLCacheKey, Array<Promise<GraphQLCacheValue>>>
119 ```
120
121### Patch
122
123- Updated dev dependencies.
124- Improved the test utility `promisifyEvent` function.
125- Test the the `GraphQL` instance method `operate` option `reloadOnLoad` in isolation.
126- Test better the order of the `GraphQL` instance method `operate` triggered events.
127- Refactored the `GraphQL` instance method `operate` to eliminate the `GraphQL` private instance method `fetch` and reduce the chance of race conditions in consumer code.
128- Reduced the number of promises created by the `GraphQL` instance method `operate` when the `reloadOnLoad` and `reloadOnLoad` options are `false`.
129- Added a code example for how to await all loading GraphQL operations.
130- Used consistent JSDoc types for promises that resolve `void`.
131- Tweaked JSDoc.
132- Tweaked changelog entries.
133
134## 11.2.0
135
136### Minor
137
138- Added a new `cacheKeyCreator` option to the `GraphQL` instance method `operate` and the `useGraphQL` React hook.
139- The previously private `hashObject` function is now publicly exported.
140
141### Patch
142
143- Replaced Node.js deprecated `notEqual` assertions with `notStrictEqual` in tests.
144- Use the `TypeError` class instead of `Error` for relevant errors.
145
146## 11.1.0
147
148### Minor
149
150- Allow React component `displayName` and `propTypes` to be removed in production builds, fixing [#51](https://github.com/jaydenseric/graphql-react/issues/51).
151- 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`](https://reactjs.org/docs/hooks-reference.html#usememo) hook.
152- Memoize what the `useGraphQL` React hook returns for more efficient hook composition.
153- 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.
154
155### Patch
156
157- Updated dependencies.
158- Use [`coverage-node`](https://npm.im/coverage-node) to enforce 100% code coverage for tests.
159- Increased the universal API size-limit from 3 KB to 3.5 KB.
160- Updated the `useGraphQL` React hook examples to use the [GitHub GraphQL API](https://docs.github.com/en/graphql).
161- Improved the `useGraphQL` React hook tests.
162- Improved documentation.
163
164## 11.0.4
165
166### Patch
167
168- Clearly documented ways to `import` and `require` the package exports.
169
170## 11.0.3
171
172### Patch
173
174- Updated the [`extract-files`](https://npm.im/extract-files) dependency to [v9.0.0](https://github.com/jaydenseric/extract-files/releases/tag/v9.0.0), and used its new deep `require` path.
175- Updated dev dependencies.
176- No longer test Node.js v13 in GitHub Actions CI.
177- Corrected the Browserslist query in the Babel config for the server API.
178- Write tests as CJS and no longer separately build and test ESM and CJS to simplify package scripts, Babel and ESLint config.
179- Removed the [`@babel/plugin-proposal-class-properties`](https://npm.im/@babel/plugin-proposal-class-properties) dev dependency and config, as [`@babel/preset-env`](https://npm.im/@babel/preset-env) has handed this via it’s `shippedProposals` options [since v7.10.0](https://babeljs.io/blog/2020/05/25/7.10.0#class-properties-and-private-methods-to-shippedproposals-option-of-babel-preset-env-11451-https-githubcom-babel-babel-pull-11451).
180- Removed unnecessary `.js` file extensions from `require` paths.
181- Improved polyfilling globals in tests:
182 - Use [`revertable-globals`](https://npm.im/revertable-globals) to define globals per-test.
183 - Use [`node-fetch`](https://npm.im/node-fetch) v3 instead of [`cross-fetch`](https://npm.im/cross-fetch).
184- Removed a no longer necessary [`formdata-node`](https://npm.im/formdata-node) workaround in `graphqlFetchOptions` tests.
185- Removed `npm-debug.log` from the `.gitignore` file as npm [v4.2.0](https://github.com/npm/npm/releases/tag/v4.2.0)+ doesn’t create it in the current working directory.
186
187## 11.0.2
188
189### Patch
190
191- Updated dependencies.
192- Simplified the GitHub Actions CI config with the [`npm install-test`](https://docs.npmjs.com/cli/install-test.html) command.
193- Use Babel config `overrides` to ensure `.js` files are parsed as scripts, eliminating Babel `interopRequireDefault` helpers from transpilation output.
194- Updated Zeit/Vercel related URLs in documentation.
195- Updated the readme “Apollo comparison” section.
196
197## 11.0.1
198
199### Patch
200
201- 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.
202- Updated dependencies.
203- Simplified JSX boolean props in tests.
204- Improved event documentation.
205- Fixed an incorrect `reportCacheErrors` JSDoc parameter type.
206- Updated EditorConfig.
207
208## 11.0.0
209
210### Major
211
212- Added a [package `exports` field](https://nodejs.org/api/esm.html#esm_package_exports) to support native ESM in Node.js.
213- 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](https://nodejs.org/api/esm.html#esm_approach_1_use_an_es_module_wrapper).
214- Updated Node.js support from v10+ to `10 - 12 || >= 13.7` to reflect the package `exports` related breaking changes.
215
216### Patch
217
218- Updated dependencies.
219- Added a new [`babel-plugin-transform-runtime-file-extensions`](https://npm.im/babel-plugin-transform-runtime-file-extensions) dev dependency to simplify Babel config.
220- Improved the package `prepare:prettier` and `test:prettier` scripts.
221- Reordered the package `test:eslint` script args for consistency with `test:prettier`.
222- Configured Prettier option `semi` to the default, `true`.
223- Reconfigured [`size-limit`](https://npm.im/size-limit):
224 - Separately test the universal and server only exports, without using unpublished size limit entry files that bloat the measured sizes.
225 - Separately test the ESM and CJS exports.
226 - Separately limit tests, with the universal ESM and CJS set to a 3 KB maximum size.
227- Removed redundant ESLint disable comments.
228- Also run GitHub Actions with Node.js v14.
229- Updated readme content.
230- Updated JSDoc code examples:
231 - Prettier formatting.
232 - Import React in examples containing JSX.
233 - Use Node.js ESM compatible import specifiers.
234
235## 10.0.0
236
237### Major
238
239- Updated Node.js support from v8.10+ to v10+.
240- Updated dependencies, some of which require Node.js v10+.
241- Replaced the [`tap`](https://npm.im/tap) dev dependency with [`test-director`](https://npm.im/test-director) and [`hard-rejection`](https://npm.im/hard-rejection), and refactored tests accordingly. This improves the dev experience and reduced the dev install size by ~75.5 MB.
242- Use `ReactDOM.unstable_batchedUpdates` in the `useGraphQL` React hook to reduce the number of renders when loading completes, fixing [#38](https://github.com/jaydenseric/graphql-react/issues/38) via [#42](https://github.com/jaydenseric/graphql-react/pull/42). Although [`react-dom`](https://npm.im/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.
243
244### Patch
245
246- Updated tests for compatibility with updated dependencies.
247- Removed the [`object-assign`](https://npm.im/object-assign) dependency and several Babel dev dependencies after simplifying the Babel config.
248- Added a new [`babel-plugin-transform-require-extensions`](https://npm.im/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](https://nodejs.org/api/esm.html#esm_mandatory_file_extensions). Published CJS `.js` files now also have file extensions in `require` paths.
249- Stop using [`husky`](https://npm.im/husky) and [`lint-staged`](https://npm.im/lint-staged).
250- Lint fixes for [`prettier`](https://npm.im/prettier) v2.
251- Tidied Babel configs.
252- Ensure GitHub Actions run on pull request.
253- Use strict mode for scripts.
254- Readme “Apollo comparison” section corrections and tweaks.
255
256## 9.1.0
257
258### Minor
259
260- Setup [GitHub Sponsors funding](https://github.com/sponsors/jaydenseric):
261 - Added `.github/funding.yml` to display a sponsor button in GitHub.
262 - Added a `package.json` `funding` field to enable npm CLI funding features.
263
264### Patch
265
266- Updated dev dependencies.
267
268## 9.0.0
269
270### Major
271
272- Updated Node.js support from v8.5+ to v8.10+, to match what the [`eslint`](https://npm.im/eslint) dev dependency now supports. This is unlikely to be a breaking change for the published package.
273- 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.
274
275### Patch
276
277- Updated dependencies.
278- Replaced the [`size-limit`](https://npm.im/size-limit) dev dependency with [`@size-limit/preset-small-lib`](https://npm.im/@size-limit/preset-small-lib).
279- 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.
280- Tweaked the `useGraphQL` option `loadOnReset` documentation.
281- Removed `package-lock.json` from `.gitignore` and `.prettierignore` as it’s disabled in `.npmrc` anyway.
282- Removed redundant ESLint ignore comments.
283- Use GitHub Actions instead of Travis for CI.
284- Minor simplification in `useGraphQL` tests.
285- Documentation improvements, fixing [#35](https://github.com/jaydenseric/graphql-react/issues/35):
286 - Updated the project description with better phrasing that includes the bundle size.
287 - Moved the readme “Apollo comparison” section to the end, and updated the “Bundle impact” subsection for the new Apollo React hooks API.
288 - Added a basic example of the core API features working together to the “Examples” section, with tips commented.
289 - Clarified that Opera Mini isn’t supported in the Browserslist queries and readme “Support” section.
290 - Cleaner readme “API” section table of contents with “See” and “Examples” headings excluded, thanks to [`jsdoc-md` v3.1.0](https://github.com/jaydenseric/jsdoc-md/releases/tag/v3.1.0).
291
292## 8.3.0
293
294### Minor
295
296- Added a `response` property to the `GraphQL` instance `cache` event payload, containing the original `fetch` [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) instance the `cacheValue` was derived from.
297
298### Patch
299
300- Updated dependencies.
301- Increased the post SSR hydration time from 500 to 1000 milliseconds, closing [#37](https://github.com/jaydenseric/graphql-react/issues/37).
302- Added a `useGraphQL` options guide for common situations.
303- Test the `GraphQL` instance method `operate` with both `reloadOnLoad` and `resetOnLoad` options `true`.
304- Use string `FormData` field names, as some `FormData` polyfills don't coerce numbers like native implementations do.
305- Test files in variables result in appropriate fetch options for a valid [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec).
306- Tidied test names.
307- Nicer Browserslist syntax for supported Node.js versions.
308
309## 8.2.0
310
311### Minor
312
313- Added a new `GraphQLProvider` component that prevents unnecessary loading on the client after SSR, fixing [#4](https://github.com/jaydenseric/graphql-react/issues/4). This component should be used instead of using `GraphQLContext.Provider` directly. The old way still works, but with the old behavior.
314
315### Patch
316
317- Updated dev dependencies.
318- Updated the `GraphQLContext.Consumer` example to use React hooks.
319
320## 8.1.3
321
322### Patch
323
324- Updated dependencies.
325- Adopted the new [`size-limit`](https://npm.im/size-limit) config file name.
326- Slightly faster `useGraphQL` render error when options `reloadOnLoad` and `resetOnLoad` are both `true`.
327- Use a ref instead of a variable in `useGraphQL` to track mounted status for cache related callbacks.
328- Document the `GraphQL` instance method `operate` option `reloadOnLoad`.
329- Minor readme quotes consistency tweak.
330
331## 8.1.2
332
333### Patch
334
335- Updated dependencies.
336- 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.
337- 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`.
338- Discuss Apollo Client fragment matcher config in the “Apollo comparison” readme section.
339
340## 8.1.1
341
342### Patch
343
344- Updated a dev dependency.
345- Removed redundant `useGraphQL` internal `useEffect` React hook second arguments.
346- 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.
347
348## 8.1.0
349
350### Minor
351
352- 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](https://github.com/jaydenseric/graphql-react/issues/26).
353- Added the `useGraphQL` React hook `reloadOnLoad` option.
354
355### Patch
356
357- Updated dependencies.
358- More reliable `useGraphQL` React hook `loadOnMount` option implementation that fixes ESLint `react-hooks/exhaustive-deps` rule errors.
359- Use `function` instead of `const` declarations in places to simplify transpiled output.
360- `GraphQL.reset()` test name typo fix.
361- Added tests for the `useGraphQL` React hook `reloadOnLoad` and `resetOnLoad` options.
362- 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.
363- Improved `GraphQL` instance event documentation.
364
365## 8.0.2
366
367### Patch
368
369- Updated dev dependencies.
370- `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.
371
372## 8.0.1
373
374### Patch
375
376- Updated dev dependencies.
377- `useGraphQL` React hook bug fixes for when arguments change after the initial render:
378 - Changes that cause the `cacheKey` to change trigger a reload if the `loadOnMount` option is `true`, fixing [#23](https://github.com/jaydenseric/graphql-react/issues/23).
379 - Fixed stale operation status properties being returned.
380- Use [`react-test-renderer`](https://npm.im/react-test-renderer) to test `useGraphQL` with a lot more detail.
381- Capitalized the `React` namespace in `useGraphQL`.
382- Improved `hashObject()` tests.
383
384## 8.0.0
385
386### Major
387
388- Updated the [`react`](https://npm.im/react) and [`react-dom`](https://npm.im/react-dom) peer dependencies to `^16.8.0`.
389- Removed the `Query` component.
390- No longer exporting `Provider` and `Consumer`; now `GraphQLContext` is exported.
391- The `GraphQL` instance method `query` has been renamed `operate`.
392- The `GraphQL` constructor no longer has the `logErrors` option, and GraphQL operation errors are no longer console logged by default.
393- The `ssr` function is now exported from `graphql-react/server` instead of `graphql-react/lib/ssr`.
394- The `ssr` function is now implemented using `async`/`await` syntax.
395- Browser (and less commonly server) environments that fetch GraphQL operations with file uploads must now support (natively or by polyfill) the [`FormData.entries()`](https://developer.mozilla.org/docs/Web/API/FormData/entries) API.
396
397 Caching of [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) 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.
398
399 There is still room to improve as `FormData` field values that are `File` or `Blob` instances don’t influence the cache key hashing.
400
401- `GraphQL` event properties have been renamed or added:
402 - The `fetch` event property `fetchOptionsHash` was renamed `cacheKey`, and the property `cache` was renamed `cacheValuePromise`.
403 - The `cache` event property `fetchOptionsHash` was renamed `cacheKey`, and the property `cacheValue` was added.
404 - The `reset` event property `exceptFetchOptionsHash` was renamed `exceptCacheKey`.
405
406### Minor
407
408- Added the `useGraphQL` React hook, which assumes the role of the removed `Query` component.
409- Documented the `GraphQL` `on` and `off` methods for managing event listeners.
410- Added the `reportCacheErrors` function, a `GraphQL` `cache` event handler that can be setup to report GraphQL operation errors via `console.log()`.
411
412### Patch
413
414- Updated dev dependencies.
415- Updated the package description and keywords.
416- Simplified the `prepublishOnly` script.
417- Use the [`tap`](https://npm.im/tap) CLI and default reporter for tests.
418- New project directory structure.
419- Separate Babel configs for optimal universal, server, and test environment code.
420- Much improved tests.
421- Run size limit tests last in the package `test` script as they are the slowest.
422- Smaller package size limits for server (3 KB down to 2.5 KB) and browser (2.5 KB down to 2 KB) environments.
423- Improved JSDoc types and API documentation.
424- Updated the readme intro and added a new “Apollo comparison” section.
425
426## 7.0.0
427
428### Major
429
430- Removed the `preload` function. It was not going to work with React hooks.
431- Added the [`react-dom`](https://npm.im/react-dom) peer dependency.
432- Reorganized file structure. This is only a breaking change for consumers that were not importing the documented way (via the `main` package entry).
433
434### Minor
435
436- 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`](https://reactjs.org/docs/react-dom-server) for rendering.
437- `GraphQL` now emits a `cache` promise in the `fetch` event payload. These events are undocumented, so this could be considered an internal change.
438
439### Patch
440
441- Updated dependencies.
442- Handle exceptions outside tests (see [tapjs/node-tap#463 (comment)](https://github.com/tapjs/node-tap/issues/463#issuecomment-456701261)).
443- Added a `ReactNode` JSDoc type, replacing `ReactElement` types.
444- Removed tests made redundant by the removal of the `preload` function.
445- Document [the official Next.js example](https://github.com/vercel/next.js/tree/canary/examples/with-graphql-react).
446- Improved documentation.
447
448## 6.0.1
449
450### Patch
451
452- Updated dev dependencies.
453- Removed the [`watch`](https://npm.im/watch) dev dependency and `watch` package script.
454- `preload` now properly catches render errors nested under `Query` components.
455- `preload` now supports class components that don’t call their base constructor with `props`, fixing [#17](https://github.com/jaydenseric/graphql-react/issues/17).
456- Fixed a prop type warning in one of the tests.
457- Fixed example code typos in the readme “Usage” section.
458- Fixed incorrect `graphQLErrors` JSDoc type.
459
460## 6.0.0
461
462### Major
463
464- Made `preload` reject upon render errors instead of throwing.
465
466### Minor
467
468- Made `Query` component throw a helpful render error if the GraphQL context is missing.
469
470### Patch
471
472- Updated dev dependencies.
473- Improved [`size-limit`](https://npm.im/size-limit) tests:
474 - Drop the CJS entrypoint; modern bundlers don’t use it and nested module imports revert resolve ESM anyway.
475 - Ignore [`prop-types`](https://npm.im/prop-types) since it’s likely to already be present in a React project, and most frameworks strip it out in production bundles anyway.
476 - Separately limit and test server and client bundles.
477
478## 5.0.0
479
480### Major
481
482- Updated the [`extract-files`](https://npm.im/extract-files) dependency to v5:
483 - The original operation object is no longer modified when it contains files.
484 - If the same file is used in multiple locations of an operation it is only uploaded once.
485
486### Patch
487
488- Updated dependencies.
489- Removed a redundant `.prettierignore` entry.
490- Added tests for the internal `graphqlFetchOptions` function.
491
492## 4.2.0
493
494### Minor
495
496- Added a new `GraphQL` constructor option `logErrors` (default `true`) and instance property, controlling if GraphQL request errors should be console logged for easy debugging.
497
498### Patch
499
500- Updated dependencies.
501- Refactored `GraphQL` static methods to separate modules.
502- Moved JSDoc type definitions into the index file.
503- Manually composed package exports instead of relying on `*`.
504- More consistent object snapshots in tests.
505
506## 4.1.0
507
508### Minor
509
510- Support more browsers by changing the [Browserslist](https://github.com/browserslist/browserslist) query from [`> 1%`](https://browserl.ist/?q=%3E+1%25) to [`> 0.5%, not dead`](https://browserl.ist/?q=%3E+0.5%25%2C+not+dead).
511
512### Patch
513
514- Updated dependencies.
515- Fix Babel not reading from the package `browserslist` field due to [a sneaky `@babel/preset-env` breaking change](https://github.com/babel/babel/pull/8509).
516- Add back the bundle size test accidentally removed in v4.0.1.
517
518## 4.0.1
519
520### Patch
521
522- Fixed `preload` for `production` `NODE_ENV`, fixing [#11](https://github.com/jaydenseric/graphql-react/issues/11) and [#12](https://github.com/jaydenseric/graphql-react/issues/12).
523- `preload` now scopes context under providers.
524- Removed redundant uses of `this` in the internal `GraphQLQuery` component constructor.
525- Test the library with undefined and `production` `NODE_ENV`.
526
527## 4.0.0
528
529### Major
530
531- Updated the `react` peer dependency to `^16.6.0`.
532- Fixed `preload` broken due to the [React v16.6.0](https://github.com/facebook/react/releases/tag/v16.6.0) [context API change](https://github.com/facebook/react/pull/13829), fixing [#11](https://github.com/jaydenseric/graphql-react/issues/11).
533
534### Patch
535
536- Updated dev dependencies.
537
538## 3.0.0
539
540### Major
541
542- 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.
543- New internal event system, fixing [#10](https://github.com/jaydenseric/graphql-react/issues/10). Now the `loading` parameter of `Query` component render functions change when identical requests are loaded elsewhere in the app.
544
545### Minor
546
547- Improved `Provider` and `Consumer` component display names in React dev tools:
548 - `Context.Provider` → `GraphQLContext.Provider`
549 - `Context.Consumer` → `GraphQLContext.Consumer`
550
551### Patch
552
553- Updated dependencies.
554- Updated package scripts and config for the new [`husky`](https://npm.im/husky) version.
555- 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.
556- Renamed the `Operation` type `GraphQLOperation`.
557- Use [jsDelivr](https://jsdelivr.com) for the readme logo instead of [RawGit](https://rawgit.com) as they are shutting down.
558
559## 2.0.1
560
561### Patch
562
563- Updated dependencies.
564- Remove the `GraphQLQuery` component from API documentation as it used internally and is not exported.
565- Regenerated the readme API docs using the latest [`jsdoc-md`](https://npm.im/jsdoc-md) version.
566- Added a new “Usage” readme section.
567- Fixed a link in the readme.
568- Fixed example GraphQL query typos.
569
570## 2.0.0
571
572### Major
573
574- Updated Node.js support from v7.6+ to v8.5+.
575
576### Minor
577
578- Use package `prepare` script to support installation via Git (e.g. `npm install jaydenseric/graphql-react`).
579- Use [`@babel/plugin-transform-runtime`](https://npm.im/@babel/plugin-transform-runtime) and [`@babel/runtime`](https://npm.im/@babel/runtime) to make runtime helpers more DRY. Bundle size savings will manifest once more packages import the same helpers.
580- Package [marked side-effect free](https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free) for bundlers and tree-shaking.
581
582### Patch
583
584- Updated dependencies.
585- 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.
586- Fixed new Prettier lint errors and removed the `fake-tag` dev dependency now that Prettier can format template literals tagged with `/* GraphQL */`.
587- Stopped using [`npm-run-all`](https://npm.im/npm-run-all) for package scripts to reduce complexity and bugs.
588- Compact package `repository` field.
589- Added more package tags.
590- Lint `.yml` files.
591- Test with [`graphql-api-koa`](https://npm.im/graphql-api-koa) instead of [`express-graphql`](https://npm.im/express-graphql).
592- Fixed test snapshot consistency between Node.js versions (see [tapjs/node-tap#450](https://github.com/tapjs/node-tap/issues/450)).
593- Use [`jsdoc-md`](https://npm.im/jsdoc-md) instead of [`documentation`](https://npm.im/documentation) to generate readme API docs.
594- JSDoc fixes and improvements.
595- Readme badge changes to deal with [shields.io](https://shields.io) unreliability:
596 - Used the more reliable build status badge provided by Travis, configured to only track `master` branch.
597 - Removed the licence badge. The licence can be found in `package.json` and rarely changes.
598 - Removed the Github issues and stars badges. The readme is most viewed on Github anyway.
599 - Use [Badgen](https://badgen.net) for the npm version badge.
600
601## 1.0.1
602
603### Patch
604
605- Updated dependencies.
606- Fixed accidental distribution code Prettier ignoring.
607- 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.
608- Tests run against the actual dist `.mjs` and `.js` files in native ESM (`--experimental-modules`) and CJS environments.
609- Ignore [`object-assign`](https://npm.im/object-assign) for bundle size tests as it’s a React dependency and tighten the allowed bundle size from 4 KB to 3 KB.
610- Updated Babel config:
611 - Use `babel.config.js` instead of `.babelrc.js`.
612 - Renamed the `ESM` environment variable to `BABEL_ESM` to be more specific.
613- Improved `package.json` scripts:
614 - Leveraged [`npm-run-all`](https://npm.im/npm-run-all) more for parallelism and reduced noise.
615 - Removed linting fix scripts.
616 - Linting included in the `test` script. Travis CI will fail PR's with lint errors.
617 - Custom watch script.
618 - No longer use [`cross-env`](https://npm.im/cross-env); contributors with Windows may setup and use a Bash shell.
619- Improved ESLint config:
620 - Use [eslint-config-env](https://npm.im/eslint-config-env).
621 - Removed redundant `eslint-plugin-ava` dev dependency and config.
622 - Undo overriding ESLint ignoring dotfiles by default as there are none now.
623- Moved the example project to [a separate repo](https://github.com/jaydenseric/graphql-react-examples).
624- Better readme logo alt text.
625
626## 1.0.0
627
628### Major
629
630- 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.
631
632### Patch
633
634- Updated dependencies.
635- Pinned `@babel` dev dependencies to match new AVA requirements.
636- Use [`eslint-config-prettier`](https://npm.im/eslint-config-prettier).
637- Readme example link goes to the example project directory instead of the readme file.
638- Test and example updates:
639 - Use [`fake-tag`](https://npm.im/fake-tag) for GraphQL template literals due to [prettier/prettier#4360](https://github.com/prettier/prettier/issues/4360).
640 - Use [`express`](https://npm.im/express) instead of Koa packages.
641 - Use [`express-graphql`](https://npm.im/express-graphql) instead of Apollo packages.
642- Test updates:
643 - Removed [`apollo-upload-server`](https://npm.im/apollo-upload-server) as there are no upload tests yet.
644 - Removed [`get-port`](https://npm.im/get-port) as not providing a port to `app.listen` has the same effect.
645- Example updates:
646 - Stop using [`esm`](https://npm.im/esm) due to [graphql/express-graphql#425](https://github.com/graphql/express-graphql/issues/425).
647 - Enabled GraphiQL and added a link to it on the homepage.
648
649## 1.0.0-alpha.5
650
651### Major
652
653- Updated the `react` peer dependency to `^16.3.1`.
654- Fixed `preload` broken due to the [React v16.3.1](https://github.com/facebook/react/releases/tag/v16.3.1) [context API change](https://github.com/facebook/react/pull/12501).
655
656### Patch
657
658- Updated dependencies.
659- Example updates:
660 - Valid length app manifest `short_name`.
661 - Added `<html>` `lang` attribute.
662 - Added Twitter card meta tags.
663
664## 1.0.0-alpha.4
665
666### Minor
667
668- 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.
669
670### Patch
671
672- Updated dependencies.
673- Replaced [`isomorphic-unfetch`](https://npm.im/isomorphic-unfetch) with the more updated [`cross-fetch`](https://npm.im/cross-fetch).
674- Use `.prettierignore` to defer `package.json` formatting to npm.
675- Improved the example web app and deployed it to [graphql-react.now.sh](https://graphql-react.now.sh).
676
677## 1.0.0-alpha.3
678
679### Minor
680
681- Support the legacy React context API, fixing [#7](https://github.com/jaydenseric/graphql-react/issues/7).
682
683### Patch
684
685- Use [`eslint-plugin-ava`](https://npm.im/eslint-plugin-ava).
686
687## 1.0.0-alpha.2
688
689### Major
690
691- Removed the `Promise` polyfill; consumers can polyfill as required for optimal bundle size. Required polyfills are documented in the readme.
692
693### Minor
694
695- Significantly reduced the bundle size to < 4 KB by simplifying Babel helpers and reusing the [`object-assign`](https://npm.im/object-assign) React dependency with [`babel-plugin-transform-replace-object-assign`](https://npm.im/babel-plugin-transform-replace-object-assign).
696
697### Patch
698
699- Updated dependencies.
700- Updated ESLint config:
701 - `parserOptions` is unnecessary when using `babel-eslint`.
702 - Enabled `prefer-destructuring` rule.
703
704## 1.0.0-alpha.1
705
706### Major
707
708- Updated Node.js support to v7.6+.
709- Renamed `GraphQLProvider` and `GraphQLConsumer` to `Provider` and `Consumer`.
710- No longer exporting `GraphQLQuery`.
711- Swapped the `GraphQLQuery` and `Query` names.
712- Removed `GraphQLMutation` component; `GraphQLQuery` can be used for both queries and mutations.
713- `GraphQLQuery` component `loadOnMount` and `loadOnReset` props now default to `false`:
714 - Opt-in is safer for mutations.
715 - Removing `static defaultProps` reduces bundle size.
716 - Nicer valueless boolean props (`<GraphQLQuery />` and `<GraphQLQuery loadOnReset />` vs `<GraphQLQuery loadOnReset={false} />` and `<GraphQLQuery loadOnReset={true} />`.
717- The `GraphQL` `query` instance method now accepts an options object.
718- New approach to configuring GraphQL request fetch options:
719 - Removed the `GraphQL` constructor `requestOptions` option.
720 - 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.
721 - The Next.js example app has been updated to demo the new API using the external [GraphQL Pokémon](https://github.com/lucasbento/graphql-pokemon) API.
722
723### Minor
724
725- New `preload` API for server side rendering, fixing [#2](https://github.com/jaydenseric/graphql-react/issues/2).
726- 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](https://github.com/jaydenseric/graphql-react/issues/3).
727- The `GraphQL` `reset` instance method now accepts a fetch options hash to exempt a request from cache deletion.
728
729### Patch
730
731- Updated dependencies.
732- 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`.
733- Simplified the JSDoc script, now that [Documentation.js handles `.mjs`](https://github.com/documentationjs/documentation/pull/1023).
734- Prevent lib or example updates from triggering tests in watch mode.
735- Fixed the example setup script and made `graphql-react` a published dependency, via [#1](https://github.com/jaydenseric/graphql-react/pull/1).
736- Commented GraphQL template literals for editor syntax highlighting.
737- Configured [Travis](https://travis-ci.org/jaydenseric/graphql-react) and added a build status readme badge.
738- Improved API documentation.
739
740## 0.1.0
741
742Initial release.
743
\No newline at end of file