From 3813c3725e040a4c1e0c798e5f7be6e5865e4ed6 Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Sat, 13 Nov 2021 08:31:30 +0100 Subject: [PATCH 1/3] feat(hydration): remove hydration package --- hydration/package.json | 6 ------ rollup.config.js | 1 - src/hydration/index.ts | 15 --------------- 3 files changed, 22 deletions(-) delete mode 100644 hydration/package.json delete mode 100644 src/hydration/index.ts diff --git a/hydration/package.json b/hydration/package.json deleted file mode 100644 index 804509cb4d..0000000000 --- a/hydration/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "internal": true, - "main": "../lib/hydration/index.js", - "module": "../es/hydration/index.js", - "types": "../types/hydration/index.d.ts" -} diff --git a/rollup.config.js b/rollup.config.js index 528bebbaf5..f11400c4c2 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -19,7 +19,6 @@ const inputSrcs = [ ['src/index.ts', 'ReactQuery', 'react-query'], ['src/core/index.ts', 'ReactQueryCore', 'react-query-core'], ['src/devtools/index.ts', 'ReactQueryDevtools', 'react-query-devtools'], - ['src/hydration/index.ts', 'ReactQueryHydration', 'react-query-hydration'], [ 'src/persistQueryClient-experimental/index.ts', 'ReactQueryPersistQueryClientExperimental', diff --git a/src/hydration/index.ts b/src/hydration/index.ts deleted file mode 100644 index 1c8a35e43a..0000000000 --- a/src/hydration/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This package once contained these functions, but they have now been moved -// into the core and react packages. -// They are re-exported here to avoid a breaking change, but this package -// should be considered deprecated and removed in a future major version. -export { dehydrate, hydrate, useHydrate, Hydrate } from 'react-query' - -// Types -export type { - DehydrateOptions, - DehydratedState, - HydrateOptions, - ShouldDehydrateMutationFunction, - ShouldDehydrateQueryFunction, -} from '../core/hydration' -export type { HydrateProps } from '../react/Hydrate' From 7cdf3cbdfdcd588be87f4975e24f2580f4d6fedf Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Sat, 13 Nov 2021 08:41:47 +0100 Subject: [PATCH 2/3] feat(hydration): update docs --- docs/src/manifests/manifest.json | 7 ++++++- .../guides/migrating-to-react-query-4.md | 19 +++++++++++++++++++ docs/src/pages/reference/hydration.md | 8 -------- 3 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 docs/src/pages/guides/migrating-to-react-query-4.md diff --git a/docs/src/manifests/manifest.json b/docs/src/manifests/manifest.json index 18ad4cd4e5..1c97c82318 100644 --- a/docs/src/manifests/manifest.json +++ b/docs/src/manifests/manifest.json @@ -204,6 +204,11 @@ "title": "Migrating to React Query 3", "path": "/guides/migrating-to-react-query-3", "editUrl": "/guides/migrating-to-react-query-3.md" + }, + { + "title": "Migrating to React Query 4", + "path": "/guides/migrating-to-react-query-4", + "editUrl": "/guides/migrating-to-react-query-4.md" } ] }, @@ -442,4 +447,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/docs/src/pages/guides/migrating-to-react-query-4.md b/docs/src/pages/guides/migrating-to-react-query-4.md new file mode 100644 index 0000000000..65e54687e1 --- /dev/null +++ b/docs/src/pages/guides/migrating-to-react-query-4.md @@ -0,0 +1,19 @@ +--- +id: migrating-to-react-query-4 +title: Migrating to React Query 4 +--- + +## Breaking Changes + +### Separate hydration exports have been removed + +With version [3.22.0](https://github.com/tannerlinsley/react-query/releases/tag/v3.22.0), hydration utilities moved into the react-query core. With v3, you could still use the old exports from `react-query/hydration`, but these exports have been removed with v4. + +```diff +- import { dehydrate, hydrate, useHydrate, Hydrate } from 'react-query/hydration' ++ import { dehydrate, hydrate, useHydrate, Hydrate } from 'react-query' +``` + + + + diff --git a/docs/src/pages/reference/hydration.md b/docs/src/pages/reference/hydration.md index 0ea0040063..f1694fb634 100644 --- a/docs/src/pages/reference/hydration.md +++ b/docs/src/pages/reference/hydration.md @@ -15,8 +15,6 @@ const dehydratedState = dehydrate(queryClient, { }) ``` -> Note: Since version `3.22.0` hydration utilities moved into to core. If you using lower version your should import `dehydrate` from `react-query/hydration` - **Options** - `client: QueryClient` @@ -72,8 +70,6 @@ import { hydrate } from 'react-query' hydrate(queryClient, dehydratedState, options) ``` -> Note: Since version `3.22.0` hydration utilities moved into to core. If you using lower version your should import `hydrate` from `react-query/hydration` - **Options** - `client: QueryClient` @@ -99,8 +95,6 @@ import { useHydrate } from 'react-query' useHydrate(dehydratedState, options) ``` -> Note: Since version `3.22.0` hydration utilities moved into to core. If you using lower version your should import `useHydrate` from `react-query/hydration` - **Options** - `dehydratedState: DehydratedState` @@ -123,8 +117,6 @@ function App() { } ``` -> Note: Since version `3.22.0` hydration utilities moved into to core. If you using lower version your should import `Hydrate` from `react-query/hydration` - **Options** - `state: DehydratedState` From d76a1effa58ee36db75914b4b19fdb43e20fd3e4 Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Sat, 13 Nov 2021 08:48:06 +0100 Subject: [PATCH 3/3] feat(hydration): remove reference to hydration package --- tsconfig.types.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tsconfig.types.json b/tsconfig.types.json index f95e1f4c19..820f702ad9 100644 --- a/tsconfig.types.json +++ b/tsconfig.types.json @@ -11,7 +11,6 @@ }, "files": [ "./src/index.ts", - "./src/hydration/index.ts", "./src/devtools/index.ts", "./src/persistQueryClient-experimental/index.ts", "./src/createWebStoragePersistor-experimental/index.ts",