Compare commits

...

3 Commits

Author SHA1 Message Date
Julien Huang
836be6816d
Merge 7c2bb85054 into cf8142b734 2024-11-19 15:12:44 -05:00
Julien Huang
7c2bb85054
Apply suggestions from code review
Co-authored-by: Damian Głowala <damian.glowala.rebkow@gmail.com>
2024-10-13 22:33:55 +02:00
Julien Huang
293ea09866 docs: warn about refreshNuxtData not working with asyncData 2024-10-13 22:26:42 +02:00
2 changed files with 8 additions and 0 deletions

View File

@ -36,6 +36,10 @@ export default defineNuxtComponent({
</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 Options API.
::
## `head()`
If you choose not to use `setup()` in your app, you can use the `head()` method within your component definition:

View File

@ -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`.
::
::warning
`refreshNuxtData` only works with Composition API. `asyncData` hook from the Options API does not work with `refreshNuxtData`.
::
## Type
```ts