mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
f26a801775
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Daniel Roe <daniel@roe.dev>
24 lines
696 B
Markdown
24 lines
696 B
Markdown
---
|
|
title: 'clearNuxtData'
|
|
description: Delete cached data, error status and pending promises of useAsyncData and useFetch.
|
|
links:
|
|
- label: Source
|
|
icon: i-simple-icons-github
|
|
to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/asyncData.ts
|
|
size: xs
|
|
---
|
|
|
|
::callout
|
|
This method is useful if you want to invalidate the data fetching for another page.
|
|
::
|
|
|
|
## Type
|
|
|
|
```ts
|
|
clearNuxtData (keys?: string | string[] | ((key: string) => boolean)): void
|
|
```
|
|
|
|
## Parameters
|
|
|
|
* `keys`: One or an array of keys that are used in [`useAsyncData`](/docs/api/composables/use-async-data) to delete their cached data. If no keys are provided, **all data** will be invalidated.
|