Loading...
Error: {query.error.message}
{todo.title}
} -{todo.title}
}Loading...
{todo.title}
} + {(todo) => ( + + )}Current Page: {{ page }} | Previous data: {{ isPreviousData }}
-- 
diff --git a/docs/vue/guides/placeholder-query-data.md b/docs/vue/guides/placeholder-query-data.md
index 6075f554c6..ed72d18dcc 100644
--- a/docs/vue/guides/placeholder-query-data.md
+++ b/docs/vue/guides/placeholder-query-data.md
@@ -4,7 +4,7 @@ title: Placeholder Query Data
 ref: docs/react/guides/placeholder-query-data.md
 ---
 
-[//]: # 'Example'
+[//]: # 'ExampleValue'
 
 ```tsx
 const result = useQuery({
@@ -14,12 +14,10 @@ const result = useQuery({
 })
 ```
 
-[//]: # 'Example'
+[//]: # 'ExampleValue'
 [//]: # 'Memoization'
 [//]: # 'Memoization'
-[//]: # 'Example2'
-[//]: # 'Example2'
-[//]: # 'Example3'
+[//]: # 'ExampleCache'
 
 ```tsx
 const result = useQuery({
@@ -35,6 +33,6 @@ const result = useQuery({
 })
 ```
 
-[//]: # 'Example3'
+[//]: # 'ExampleCache'
 [//]: # 'Materials'
 [//]: # 'Materials'
diff --git a/docs/vue/guides/prefetching.md b/docs/vue/guides/prefetching.md
index b4e4f62020..96cb8f97e3 100644
--- a/docs/vue/guides/prefetching.md
+++ b/docs/vue/guides/prefetching.md
@@ -1,5 +1,47 @@
 ---
 id: prefetching
 title: Prefetching
-ref: docs/react/guides/prefetching.md
 ---
+
+If you're lucky enough, you may know enough about what your users will do to be able to prefetch the data they need before it's needed! If this is the case, you can use the `prefetchQuery` method to prefetch the results of a query to be placed into the cache:
+
+[//]: # 'ExamplePrefetching'
+
+```tsx
+const prefetchTodos = async () => {
+  // The results of this query will be cached like a normal query
+  await queryClient.prefetchQuery({
+    queryKey: ['todos'],
+    queryFn: fetchTodos,
+  })
+}
+```
+
+[//]: # 'ExamplePrefetching'
+
+- If **fresh** data for this query is already in the cache, the data will not be fetched
+- If a `staleTime` is passed eg. `prefetchQuery({ queryKey: ['todos'], queryFn: fn, staleTime: 5000 })` and the data is older than the specified `staleTime`, the query will be fetched
+- If no instances of `useQuery` appear for a prefetched query, it will be deleted and garbage collected after the time specified in `gcTime`.
+
+## Prefetching Infinite Queries
+
+Infinite Queries can be prefetched like regular Queries. Per default, only the first page of the Query will be prefetched and will be stored under the given QueryKey. If you want to prefetch more than one page, you can use the `pages` option, in which case you also have to provide a `getNextPageParam` function:
+
+[//]: # 'ExampleInfiniteQuery'
+
+```tsx
+const prefetchTodos = async () => {
+  // The results of this query will be cached like a normal query
+  await queryClient.prefetchInfiniteQuery({
+    queryKey: ['projects'],
+    queryFn: fetchProjects,
+    initialPageParam: 0,
+    getNextPageParam: (lastPage, pages) => lastPage.nextCursor,
+    pages: 3, // prefetch the first 3 pages
+  })
+}
+```
+
+[//]: # 'ExampleInfiniteQuery'
+
+The above code will try to prefetch 3 pages in order, and `getNextPageParam` will be executed for each page to determine the next page to prefetch. If `getNextPageParam` returns `undefined`, the prefetching will stop.
diff --git a/docs/vue/guides/queries.md b/docs/vue/guides/queries.md
index 81cac5e0eb..44559f0c93 100644
--- a/docs/vue/guides/queries.md
+++ b/docs/vue/guides/queries.md
@@ -19,14 +19,14 @@ const result = useQuery({ queryKey: ['todos'], queryFn: fetchTodoList })
 
 
 
-  Loading...
+  Loading...
   Error: {{ error.message }}
   
   
 
- 
@@ -49,7 +49,7 @@ const { status, data, error } = useQuery({
 
 
 
-  Loading...
+  Loading...
   Error: {{ error.message }}
   
   
 
- 
diff --git a/docs/vue/guides/ssr.md b/docs/vue/guides/ssr.md
index d0995a5b07..7a0098cd0c 100644
--- a/docs/vue/guides/ssr.md
+++ b/docs/vue/guides/ssr.md
@@ -213,10 +213,10 @@ This refetching of stale queries is a perfect match when caching markup in a CDN
 
 ### High memory consumption on server
 
-In case you are creating the `QueryClient` for every request, Vue Query creates the isolated cache for this client, which is preserved in memory for the `cacheTime` period. That may lead to high memory consumption on server in case of high number of requests during that period.
+In case you are creating the `QueryClient` for every request, Vue Query creates the isolated cache for this client, which is preserved in memory for the `gcTime` period. That may lead to high memory consumption on server in case of high number of requests during that period.
 
-On the server, `cacheTime` defaults to `Infinity` which disables manual garbage collection and will automatically clear memory once a request has finished. If you are explicitly setting a non-Infinity `cacheTime` then you will be responsible for clearing the cache early.
+On the server, `gcTime` defaults to `Infinity` which disables manual garbage collection and will automatically clear memory once a request has finished. If you are explicitly setting a non-Infinity `gcTime` then you will be responsible for clearing the cache early.
 
 To clear the cache after it is not needed and to lower memory consumption, you can add a call to [`queryClient.clear()`](../reference/QueryClient#queryclientclear) after the request is handled and dehydrated state has been sent to the client.
 
-Alternatively, you can set a smaller `cacheTime`.
+Alternatively, you can set a smaller `gcTime`.
diff --git a/docs/vue/installation.md b/docs/vue/installation.md
index 70ec75d080..21ab95d29b 100644
--- a/docs/vue/installation.md
+++ b/docs/vue/installation.md
@@ -5,17 +5,19 @@ title: Installation
 
 You can install Vue Query via [NPM](https://npmjs.com).
 
+> v5 is currently available as a release-candidate. We don't anticipate any major API changes from here on out. We encourage you to try it out and report any issues you find.
+
 ### NPM
 
 ```bash
-$ npm i @tanstack/vue-query
+$ npm i @tanstack/vue-query@rc
 # or
-$ pnpm add @tanstack/vue-query
+$ pnpm add @tanstack/vue-query@rc
 # or
-$ yarn add @tanstack/vue-query
+$ yarn add @tanstack/vue-query@rc
 ```
 
-> Wanna give it a spin before you download? Try out the [basic](/query/v4/docs/vue/examples/vue/basic) example!
+> Wanna give it a spin before you download? Try out the [basic](../examples/vue/basic) example!
 
 Vue Query is compatible with Vue 2.x and 3.x
 
@@ -43,7 +45,7 @@ If you are not a fan of `
 
 
-  Loading...
+  Loading...
   Error: {{ error.message }}
   
   
 
- 
diff --git a/docs/vue/typescript.md b/docs/vue/typescript.md
index e3a4f3e482..963bd0089a 100644
--- a/docs/vue/typescript.md
+++ b/docs/vue/typescript.md
@@ -49,10 +49,12 @@ const { data } = useQuery({ queryKey: ['groups'], queryFn: fetchGroups })
 [//]: # 'TypeNarrowing'
 
 ```tsx
-const { data, isSuccess } = reactive(useQuery({
-  queryKey: ['test'],
-  queryFn: () => Promise.resolve(5),
-}))
+const { data, isSuccess } = reactive(
+  useQuery({
+    queryKey: ['test'],
+    queryFn: () => Promise.resolve(5),
+  }),
+)
 
 if (isSuccess) {
   data
@@ -75,10 +77,16 @@ if (error.value instanceof Error) {
 }
 ```
 
-[typescript playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPQBuOAtAEcc+KgFgAUKEiw49AB7AIqUuUpV5i1GPESYeMOjgBxcsjBwAvIjjAAJgC44jZCABGuIhImsIzeCXQYVgALEwgzZSsACgBKRwAFVWAMAB4wswBtAF0APks8jSUAOgBzQKiqThLTMC0Yophg9EYoqHRUSGZDCzy2jt8MItt6BhivcR8-a1xyKCJLFAxsXDwopCEVgGl0PEcMqmrw2qosgBo4DfwAMUZHAKDQmuVCMfFOTjhPr4A9AH44SYsOAzaCOABK6BIKWQjHYjAgAHdGDlxsASHAoiCoEVuPQADY4Gx+JisdAQdEAUSgsxiiAknyxOPxOHpcHeX0+fwBA3gWMcVNmEkIQA)
+[typescript playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPRTr2swBaAI458VALAAoUJFhx6AD2ARUpcpSqLlqCZKkw8YdHADi5ZGDgBeRHGAATAFxxGyEACNcRKVNYRm8CToMKwAFmYQFqo2ABQAlM4ACurAGAA8ERYA2gC6AHzWBVoqAHQA5sExVJxl5mA6cSUwoeiMMTyokMzGVgUdXRgl9vQMcT6SfgG2uORQRNYoGNi4eDFIIisA0uh4zllUtZH1VDkANHAb+ABijM5BIeF1qoRjkpyccJ9fAHoA-OPAEhwGLFVAlVIAQSUKgAolBZjEZtA4nFEFJPkioOi4O84H8pIQgA)
 
 [//]: # 'TypingError'
 [//]: # 'TypingError2'
 [//]: # 'TypingError2'
+[//]: # 'TypingError3'
+[//]: # 'TypingError3'
+[//]: # 'RegisterErrorType'
+[//]: # 'RegisterErrorType'
+[//]: # 'TypingQueryOptions'
+[//]: # 'TypingQueryOptions'
 [//]: # 'Materials'
 [//]: # 'Materials'
diff --git a/examples/react/algolia/package.json b/examples/react/algolia/package.json
index 54ab060b34..5c364bc4c9 100644
--- a/examples/react/algolia/package.json
+++ b/examples/react/algolia/package.json
@@ -8,21 +8,21 @@
     "preview": "vite preview"
   },
   "dependencies": {
-    "@algolia/client-search": "4.11.0",
-    "@algolia/transporter": "4.11.0",
-    "@tanstack/react-query": "^4.7.1",
-    "@tanstack/react-query-devtools": "^4.7.1",
-    "algoliasearch": "4.12.2",
+    "@algolia/client-search": "4.17.1",
+    "@algolia/transporter": "4.17.1",
+    "@tanstack/react-query": "^5.0.0-rc.1",
+    "@tanstack/react-query-devtools": "^5.0.0-rc.1",
+    "algoliasearch": "4.17.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0"
   },
   "devDependencies": {
-    "@tanstack/eslint-plugin-query": "^4.13.0",
-    "@types/react": "^18.0.14",
-    "@types/react-dom": "^18.0.5",
-    "@vitejs/plugin-react": "^2.0.0",
-    "typescript": "^4.7.4",
-    "vite": "^3.0.0"
+    "@tanstack/eslint-plugin-query": "^5.0.0-rc.1",
+    "@types/react": "^18.2.4",
+    "@types/react-dom": "^18.2.4",
+    "@vitejs/plugin-react": "^4.0.0",
+    "typescript": "^5.0.4",
+    "vite": "^4.4.4"
   },
   "browserslist": {
     "production": [
diff --git a/examples/react/algolia/src/SearchResults.tsx b/examples/react/algolia/src/SearchResults.tsx
index 0bb39b1e18..59b353a7dd 100644
--- a/examples/react/algolia/src/SearchResults.tsx
+++ b/examples/react/algolia/src/SearchResults.tsx
@@ -24,7 +24,7 @@ export default function SearchResults({ query = '' }: SearchResultsProps) {
     query,
     hitsPerPage: 5,
     staleTime: 1000 * 30, // 30s
-    cacheTime: 1000 * 60 * 15, // 15m
+    gcTime: 1000 * 60 * 15, // 15m
     enabled: !!query,
   })
 
diff --git a/examples/react/algolia/src/algolia.ts b/examples/react/algolia/src/algolia.ts
index a3b449f6dd..bc816ac104 100644
--- a/examples/react/algolia/src/algolia.ts
+++ b/examples/react/algolia/src/algolia.ts
@@ -16,7 +16,7 @@ type SearchOptions = {
 export async function search
 
Loading...
+ if (status === 'pending') returnLoading...
if (status === 'error') return Error: {error.message} return ( diff --git a/examples/react/basic-graphql-request/package.json b/examples/react/basic-graphql-request/package.json index c4c768a2a0..ed1b796f7d 100644 --- a/examples/react/basic-graphql-request/package.json +++ b/examples/react/basic-graphql-request/package.json @@ -8,16 +8,16 @@ "preview": "vite preview" }, "dependencies": { - "graphql": "^15.3.0", - "graphql-request": "^3.1.0", - "react": "^18.0.0", - "react-dom": "^18.0.0", - "@tanstack/react-query": "^4.7.1", - "@tanstack/react-query-devtools": "^4.7.1" + "graphql": "^16.6.0", + "graphql-request": "^6.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "@tanstack/react-query": "^5.0.0-rc.1", + "@tanstack/react-query-devtools": "^5.0.0-rc.1" }, "devDependencies": { - "@vitejs/plugin-react": "^2.0.0", - "vite": "^3.0.0" + "@vitejs/plugin-react": "^4.0.0", + "vite": "^4.4.4" }, "browserslist": { "production": [ diff --git a/examples/react/basic-graphql-request/src/index.jsx b/examples/react/basic-graphql-request/src/index.jsx index 02dcdb3142..b484d73a23 100644 --- a/examples/react/basic-graphql-request/src/index.jsx +++ b/examples/react/basic-graphql-request/src/index.jsx @@ -71,7 +71,7 @@ function Posts({ setPostId }) {Posts
Posts
Posts
Posts
Infinite Query with max pages
+4 projects per page
+3 pages max
+ {status === 'pending' ? ( +Loading...
+ ) : status === 'error' ? ( + Error: {error.message} + ) : ( + <> ++ {project.name} +
+ ))} ++
Infinite Loading
- {status === 'loading' ? ( + {status === 'pending' ? (Loading...
) : status === 'error' ? ( Error: {error.message} @@ -110,9 +109,7 @@ function Example() { > )}- - Go to another page - + Go to another page
 
-
+
 
 Hooks for fetching, caching and updating asynchronous data in React, Solid, Svelte and Vue
 
@@ -12,8 +12,8 @@ Hooks for fetching, caching and updating asynchronous data in React, Solid, Svel