mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-28 08:32:06 +00:00
docs: warn about refreshNuxtData
not working with asyncData
This commit is contained in:
parent
ea1574ae1a
commit
293ea09866
@ -36,6 +36,10 @@ export default defineNuxtComponent({
|
|||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
::warning
|
||||||
|
Data from `useAsyncData` is only set once in the `setup` hook of your component. This means `refreshNuxtData` will not work with `asyncData`. If you need to re-run `useAsyncData`, you can change it with a `method` of the Option API.
|
||||||
|
::
|
||||||
|
|
||||||
## `head()`
|
## `head()`
|
||||||
|
|
||||||
If you choose not to use `setup()` in your app, you can use the `head()` method within your component definition:
|
If you choose not to use `setup()` in your app, you can use the `head()` method within your component definition:
|
||||||
|
@ -12,6 +12,10 @@ links:
|
|||||||
`refreshNuxtData` re-fetches all data from the server and updates the page as well as invalidates the cache of [`useAsyncData`](/docs/api/composables/use-async-data) , `useLazyAsyncData`, [`useFetch`](/docs/api/composables/use-fetch) and `useLazyFetch`.
|
`refreshNuxtData` re-fetches all data from the server and updates the page as well as invalidates the cache of [`useAsyncData`](/docs/api/composables/use-async-data) , `useLazyAsyncData`, [`useFetch`](/docs/api/composables/use-fetch) and `useLazyFetch`.
|
||||||
::
|
::
|
||||||
|
|
||||||
|
::warning
|
||||||
|
`refreshNuxtData` only works with composition API. `asyncData` hook from the Options API does not work with `refreshNuxtData`.
|
||||||
|
::
|
||||||
|
|
||||||
## Type
|
## Type
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
Loading…
Reference in New Issue
Block a user