Skip to content

Commit 2af306d

Browse files
authored
Merge branch 'main' into feature/angular-query
2 parents c35419b + af0ff9a commit 2af306d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎docs/react/guides/initial-query-data.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const result = useQuery({
123123

124124
### Initial Data from the cache with `initialDataUpdatedAt`
125125

126-
Getting initial data from the cache means the source query you're using to look up the initial data from is likely old, but `initialData`. Instead of using an artificial `staleTime` to keep your query from refetching immediately, it's suggested that you pass the source query's `dataUpdatedAt` to `initialDataUpdatedAt`. This provides the query instance with all the information it needs to determine if and when the query needs to be refetched, regardless of initial data being provided.
126+
Getting initial data from the cache means the source query you're using to look up the initial data from is likely old. Instead of using an artificial `staleTime` to keep your query from refetching immediately, it's suggested that you pass the source query's `dataUpdatedAt` to `initialDataUpdatedAt`. This provides the query instance with all the information it needs to determine if and when the query needs to be refetched, regardless of initial data being provided.
127127

128128
[//]: # 'Example7'
129129

‎docs/vue/guides/paginated-queries.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@ ref: docs/react/guides/paginated-queries.md
99
```vue
1010
<script setup lang="ts">
1111
import { ref, Ref } from 'vue'
12-
import { useQuery } from '@tanstack/vue-query'
12+
import { useQuery, keepPreviousData } from '@tanstack/vue-query'
1313
1414
const fetcher = (page: Ref<number>) =>
1515
fetch(
1616
`https://jsonplaceholder.typicode.com/posts?_page=${page.value}&_limit=10`,
1717
).then((response) => response.json())
1818
1919
const page = ref(1)
20-
const { isPending, isError, data, error, isFetching, isPreviousData } =
20+
const { isPending, isError, data, error, isFetching, isPlaceholderData } =
2121
useQuery({
2222
queryKey: ['projects', page],
2323
queryFn: () => fetcher(page),
24-
keepPreviousData: true,
24+
placeholderData: keepPreviousData,
2525
})
2626
const prevPage = () => {
2727
page.value = Math.max(page.value - 1, 1)
2828
}
2929
const nextPage = () => {
30-
if (!isPreviousData.value) {
30+
if (!isPlaceholderData.value) {
3131
page.value = page.value + 1
3232
}
3333
}
3434
</script>
3535
3636
<template>
3737
<h1>Posts</h1>
38-
<p>Current Page: {{ page }} | Previous data: {{ isPreviousData }}</p>
38+
<p>Current Page: {{ page }} | Previous data: {{ isPlaceholderData }}</p>
3939
<button @click="prevPage">Prev Page</button>
4040
<button @click="nextPage">Next Page</button>
4141
<div v-if="isPending">Loading...</div>

0 commit comments

Comments
 (0)