diff --git a/docs/content/3.api/3.utils/refresh-nuxt-data.md b/docs/content/3.api/3.utils/refresh-nuxt-data.md index 6e1bd435a0e..35387d05ee6 100644 --- a/docs/content/3.api/3.utils/refresh-nuxt-data.md +++ b/docs/content/3.api/3.utils/refresh-nuxt-data.md @@ -5,15 +5,67 @@ description: refreshNuxtData refetches all data from the server and updates the # `refreshNuxtData` -`refreshNuxtData` refetches all data from the server and updates the page. +`refreshNuxtData` re-fetches all data from the server and updates the page as well as invalidates the cache of `useAsyncData`, `useLazyAsyncData`, `useFetch` and `useLazyFetch`. -::ReadMore{link="/getting-started/data-fetching"} -:: +## Type ```ts refreshNuxtData(keys?: string | string[]) ``` -Available options: +**Parameters:** + +* `keys`: + + **Type**: `String | String[]` + + `refreshNuxtData` accepts a single or an array of strings as `keys` that are used to fetch the data. This parameter is **optional**. All `useAsyncData` and `useFetch` are re-fetched when no `keys` are specified. + +## Examples + +### Refresh All data + +This example below refreshes all data being fetched using `useAsyncData` and `useFetch` on the current page. + +```vue [pages/some-page.vue] + + + +``` + +### Refresh Specific Data + +This example below refreshes only data where the key matches to `count`. + +```vue [pages/some-page.vue] + -* `keys`: Provides an array of keys that are used in `useAsyncData` to refetch. When it's not specified, all `useAsyncData` and `useFetch` will be refetched. + +``` + +::ReadMore{link="/getting-started/data-fetching"} +::