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/docs/api.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ const {
26
26
enabled,
27
27
initialData,
28
28
initialStale,
29
+
placeholderData,
29
30
isDataEqual,
30
31
keepPreviousData,
31
32
notifyOnStatusChange,
@@ -137,6 +138,12 @@ const queryInfo = useQuery({
137
138
- Optional
138
139
- If set, this will mark any `initialData` provided as stale and will likely cause it to be refetched on mount
139
140
- If a function is passed, it will be called only when appropriate to resolve the `initialStale` value. This can be useful if your `initialStale` value is costly to calculate.
141
+
- `initialData` **is persisted** to the cache
142
+
- `placeholderData: any |Function() => any`
143
+
- Optional
144
+
- If set, this value will be used as the placeholder data for this particular query instance while the query is still in the `loading` data and no initialData has been provided.
145
+
- If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData
146
+
- `placeholderData` is **not persisted** to the cache
140
147
- `keepPreviousData:Boolean`
141
148
- Optional
142
149
- Defaults to `false`
@@ -176,6 +183,8 @@ const queryInfo = useQuery({
176
183
- Will be `true` if the cache data is stale.
177
184
- `isPreviousData:Boolean`
178
185
- Will be `true` when `keepPreviousData` is set and data from the previous query is returned.
186
+
- `isPlaceholderData:Boolean`
187
+
- Will be `true` if and when the query's `data` is equal to the result of the `placeholderData` option.
179
188
- `isFetchedAfterMount:Boolean`
180
189
- Will be `true` if the query has been fetched after the component mounted.
181
190
- This property can be used to not show any previously cached data.
0 commit comments