Skip to content

Commit 7aa3a01

Browse files
committed
fix(schema): turn off purgeCachedData until v4
1 parent 57b95cd commit 7aa3a01

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
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-
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:
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:
596596

597597
```ts twoslash [nuxt.config.ts]
598598
export default defineNuxtConfig({
599599
experimental: {
600-
purgeCachedData: false
600+
purgeCachedData: true
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-
* 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.
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.
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: false
588+
* purgeCachedData: true
589589
* }
590590
* })
591591
* ```
592592
*
593593
* @see [PR #31379](https://github.com/nuxt/nuxt/pull/31379)
594594
*/
595595
purgeCachedData: {
596-
$resolve: (val) => {
597-
return typeof val === 'boolean' ? val : true
596+
$resolve: async (val, get) => {
597+
return typeof val === 'boolean' ? val : ((await get('future')).compatibilityVersion === 4)
598598
},
599599
},
600600

packages/schema/src/types/schema.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,17 +1559,16 @@ export interface ConfigSchema {
15591559
/**
15601560
* Whether to clean up Nuxt static and asyncData caches on route navigation.
15611561
*
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
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.
15651564
*
15661565
* @example
15671566
* ```ts
15681567
* // nuxt.config.ts
15691568
* export default defineNuxtConfig({
15701569
* experimental: {
15711570
* // Disable automatic cache cleanup (default is true)
1572-
* purgeCachedData: false
1571+
* purgeCachedData: true
15731572
* }
15741573
* })
15751574
* ```

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