Skip to content

Commit 0674560

Browse files
committed
fix(schema): re-enable purgeCachedData by default
This reverts commit 7aa3a01.
1 parent 7aa3a01 commit 0674560

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

docs/2.guide/3.going-further/1.experimental-features.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,13 @@ const value = new SomeClass().someMethod()
591591

592592
## purgeCachedData
593593

594-
In the future, Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks
595-
and ensures fresh data is loaded when needed. You can enable it with:
594+
Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks
595+
and ensures fresh data is loaded when needed, but it is possible to disable it:
596596

597597
```ts twoslash [nuxt.config.ts]
598598
export default defineNuxtConfig({
599599
experimental: {
600-
purgeCachedData: true
600+
purgeCachedData: false
601601
}
602602
})
603603
```

packages/schema/src/config/experimental.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,25 +576,25 @@ export default defineResolvers({
576576
/**
577577
* Whether to clean up Nuxt static and asyncData caches on route navigation.
578578
*
579-
* In the future, Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`.
580-
* This will help prevent memory leaks and ensure fresh data is loaded when needed. You can enable it.
579+
* Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks
580+
* and ensures fresh data is loaded when needed, but it is possible to disable it.
581581
*
582582
* @example
583583
* ```ts
584584
* // nuxt.config.ts
585585
* export default defineNuxtConfig({
586586
* experimental: {
587587
* // Disable automatic cache cleanup (default is true)
588-
* purgeCachedData: true
588+
* purgeCachedData: false
589589
* }
590590
* })
591591
* ```
592592
*
593593
* @see [PR #31379](https://github.com/nuxt/nuxt/pull/31379)
594594
*/
595595
purgeCachedData: {
596-
$resolve: async (val, get) => {
597-
return typeof val === 'boolean' ? val : ((await get('future')).compatibilityVersion === 4)
596+
$resolve: (val) => {
597+
return typeof val === 'boolean' ? val : true
598598
},
599599
},
600600

packages/schema/src/types/schema.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,16 +1559,17 @@ export interface ConfigSchema {
15591559
/**
15601560
* Whether to clean up Nuxt static and asyncData caches on route navigation.
15611561
*
1562-
* In the future, Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`.
1563-
* This will help prevent memory leaks and ensure fresh data is loaded when needed. You can enable it.
1562+
* Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks and ensures fresh data is loaded when needed, but it is possible to disable it.
1563+
*
1564+
* @default true
15641565
*
15651566
* @example
15661567
* ```ts
15671568
* // nuxt.config.ts
15681569
* export default defineNuxtConfig({
15691570
* experimental: {
15701571
* // Disable automatic cache cleanup (default is true)
1571-
* purgeCachedData: true
1572+
* purgeCachedData: false
15721573
* }
15731574
* })
15741575
* ```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy