You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/pages/guides/initial-query-data.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ function Todo({ todoId }) {
71
71
}
72
72
```
73
73
74
-
Most of the time, this pattern works well, but if the source query you're using to look up the initial data from is old, you may not want to use the data at all and just fetch from the server. To make this decision easier, you can use the `queryClient.getQueryState` method instead to get more information about the source query, including a `state.updatedAt` timestamp you can use to decide if the query is "fresh" enough for your needs:
74
+
Most of the time, this pattern works well, but if the source query you're using to look up the initial data from is old, you may not want to use the data at all and just fetch from the server. To make this decision easier, you can use the `queryClient.getQueryState` method instead to get more information about the source query, including a `state.dataUpdatedAt` timestamp you can use to decide if the query is "fresh" enough for your needs:
75
75
76
76
```js
77
77
functionTodo({ todoId }) {
@@ -81,7 +81,7 @@ function Todo({ todoId }) {
81
81
conststate=queryClient.getQueryState('todos')
82
82
83
83
// If the query exists and has data that is no older than 10 seconds...
84
-
if (state &&Date.now() -state.updatedAt<=10*1000) {
84
+
if (state &&Date.now() -state.dataUpdatedAt<=10*1000) {
Copy file name to clipboardExpand all lines: docs/src/pages/guides/ssr.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ The setup is minimal and this can be a quick solution for some cases, but there
41
41
42
42
- If you are calling `useQuery` in a component deeper down in the tree you need to pass the `initialData` down to that point
43
43
- If you are calling `useQuery` with the same query in multiple locations, you need to pass `initialData` to all of them
44
-
- There is no way to know at what time the query was fetched on the server, so `updatedAt` and determining if the query needs refetching is based on when the page loaded instead
44
+
- There is no way to know at what time the query was fetched on the server, so `dataUpdatedAt` and determining if the query needs refetching is based on when the page loaded instead
45
45
46
46
### Using Hydration
47
47
@@ -186,7 +186,7 @@ Sometimes this behavior is not desirable, maybe you want to render an error page
186
186
187
187
### Staleness is measured from when the query was fetched on the server
188
188
189
-
A query is considered stale depending on when it was `updatedAt`. A caveat here is that the server needs to have the correct time for this to work properly, but UTC time is used, so timezones do not factor into this.
189
+
A query is considered stale depending on when it was `dataUpdatedAt`. A caveat here is that the server needs to have the correct time for this to work properly, but UTC time is used, so timezones do not factor into this.
190
190
191
191
Because `staleTime` defaults to `0`, queries will be refetched in the background on page load by default. You might want to use a higher `staleTime` to avoid this double fetching, especially if you don't cache your markup.
Copy file name to clipboardExpand all lines: docs/src/pages/reference/QueryCache.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Its available methods are:
25
25
26
26
`find` is a slightly more advanced synchronous method that can be used to get an existing query instance from the cache. This instance not only contains **all** the state for the query, but all of the instances, and underlying guts of the query as well. If the query does not exist, `undefined` will be returned.
27
27
28
-
> Note: This is not typically needed for most applications, but can come in handy when needing more information about a query in rare scenarios (eg. Looking at the query.state.updatedAt timestamp to decide whether a query is fresh enough to be used as an initial value)
28
+
> Note: This is not typically needed for most applications, but can come in handy when needing more information about a query in rare scenarios (eg. Looking at the query.state.dataUpdatedAt timestamp to decide whether a query is fresh enough to be used as an initial value)
0 commit comments