docs: update `deep` default for `useAsyncData` & `useFetch` (#28564)

This commit is contained in:
Sébastien Chopin 2024-08-16 10:45:04 +02:00 committed by GitHub
parent a4be2cb31b
commit f85cb4d6ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -72,7 +72,7 @@ const { data: posts } = await useAsyncData(
- `getCachedData`: Provide a function which returns cached data. A _null_ or _undefined_ return value will trigger a fetch. By default, this is: `key => nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key]`, which only caches data when `payloadExtraction` is enabled. - `getCachedData`: Provide a function which returns cached data. A _null_ or _undefined_ return value will trigger a fetch. By default, this is: `key => nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key]`, which only caches data when `payloadExtraction` is enabled.
- `pick`: only pick specified keys in this array from the `handler` function result - `pick`: only pick specified keys in this array from the `handler` function result
- `watch`: watch reactive sources to auto-refresh - `watch`: watch reactive sources to auto-refresh
- `deep`: return data in a deep ref object (it is `true` by default). It can be set to `false` to return data in a shallow ref object, which can improve performance if your data does not need to be deeply reactive. - `deep`: return data in a deep ref object. It is `false` by default to return data in a shallow ref object for performance.
- `dedupe`: avoid fetching same key more than once at a time (defaults to `cancel`). Possible options: - `dedupe`: avoid fetching same key more than once at a time (defaults to `cancel`). Possible options:
- `cancel` - cancels existing requests when a new one is made - `cancel` - cancels existing requests when a new one is made
- `defer` - does not make new requests at all if there is a pending request - `defer` - does not make new requests at all if there is a pending request

View File

@ -108,7 +108,7 @@ All fetch options can be given a `computed` or `ref` value. These will be watche
- `getCachedData`: Provide a function which returns cached data. A _null_ or _undefined_ return value will trigger a fetch. By default, this is: `key => nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key]`, which only caches data when `payloadExtraction` is enabled. - `getCachedData`: Provide a function which returns cached data. A _null_ or _undefined_ return value will trigger a fetch. By default, this is: `key => nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key]`, which only caches data when `payloadExtraction` is enabled.
- `pick`: only pick specified keys in this array from the `handler` function result - `pick`: only pick specified keys in this array from the `handler` function result
- `watch`: watch an array of reactive sources and auto-refresh the fetch result when they change. Fetch options and URL are watched by default. You can completely ignore reactive sources by using `watch: false`. Together with `immediate: false`, this allows for a fully-manual `useFetch`. (You can [see an example here](/docs/getting-started/data-fetching#watch) of using `watch`.) - `watch`: watch an array of reactive sources and auto-refresh the fetch result when they change. Fetch options and URL are watched by default. You can completely ignore reactive sources by using `watch: false`. Together with `immediate: false`, this allows for a fully-manual `useFetch`. (You can [see an example here](/docs/getting-started/data-fetching#watch) of using `watch`.)
- `deep`: return data in a deep ref object (it is `true` by default). It can be set to `false` to return data in a shallow ref object, which can improve performance if your data does not need to be deeply reactive. - `deep`: return data in a deep ref object. It is `false` by default to return data in a shallow ref object for performance.
- `dedupe`: avoid fetching same key more than once at a time (defaults to `cancel`). Possible options: - `dedupe`: avoid fetching same key more than once at a time (defaults to `cancel`). Possible options:
- `cancel` - cancels existing requests when a new one is made - `cancel` - cancels existing requests when a new one is made
- `defer` - does not make new requests at all if there is a pending request - `defer` - does not make new requests at all if there is a pending request

View File

@ -84,7 +84,7 @@ export interface AsyncDataOptions<
*/ */
immediate?: boolean immediate?: boolean
/** /**
* Return data in a deep ref object (it is true by default). It can be set to false to return data in a shallow ref object, which can improve performance if your data does not need to be deeply reactive. * Return data in a deep ref object (it is false by default). It can be set to false to return data in a shallow ref object, which can improve performance if your data does not need to be deeply reactive.
*/ */
deep?: boolean deep?: boolean
/** /**