Skip to content

Commit f4f4690

Browse files
authored
docs: clarify on refetchOnMountOrArgChange (#2038)
1 parent 90a8b58 commit f4f4690

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/rtk-query/usage/cache-behavior.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ const Component = () => {
154154

155155
### Encouraging re-fetching with `refetchOnMountOrArgChange`
156156

157-
Queries can be encouraged to re-fetch more frequently than usual via the [`refetchOnMountOrArgChange`](../api/createApi.mdx#refetchonmountorargchange) property. This can be passed to the endpoint as a whole, to individual hook calls, or when dispatching the [`initiate`](../api/created-api/endpoints.mdx#initiate)action.
157+
Queries can be encouraged to re-fetch more frequently than usual via the [`refetchOnMountOrArgChange`](../api/createApi.mdx#refetchonmountorargchange) property. This can be passed to the endpoint as a whole, to individual hook calls, or when dispatching the [`initiate`](../api/created-api/endpoints.mdx#initiate) action (the name of the action creator's option is `forceRefetch`).
158158

159159
`refetchOnMountOrArgChange` is used to encourage re-fetching in additional situations where the default behavior would instead serve cached data.
160160

161161
`refetchOnMountOrArgChange` accepts either a boolean value, or a number as time in seconds.
162162

163163
Passing `false` (the default value) for this property will use the default behavior [described above](#default-cache-behavior).
164164

165-
Passing `true` for this property will cause the endpoint to always refetch when a new subscriber to the query is added. If passed to an individual hook call and not the api definition itself, then this applies only to that hook call. I.e., when the component calling the hook mounts, or the argument changes, it adds a new subscriber for that query, and will always refetch, regardless of whether cached data for the endpoint + arg combination already exists.
165+
Passing `true` for this property will cause the endpoint to always refetch when a new subscriber to the query is added. If passed to an individual hook call and not the api definition itself, then this applies only to that hook call. I.e., when the component calling the hook mounts, or the argument changes, it will always refetch, regardless of whether cached data for the endpoint + arg combination already exists.
166166

167167
Passing a `number` as a value in seconds will use the following behavior:
168168

0 commit comments

Comments
 (0)