@nuxt/docs-nightly 5.0.0-29735167.d597a4e3 → 5.0.0-29735220.58223f17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -162,6 +162,7 @@ The `handler` function should be **side-effect free** to ensure predictable beha
|
|
|
162
162
|
- `cancel` - cancels existing requests when a new one is made
|
|
163
163
|
- `defer` - does not make new requests at all if there is a pending request
|
|
164
164
|
- `timeout` - a number in milliseconds to wait before timing out the request (defaults to `undefined`, which means no timeout)
|
|
165
|
+
- `enabled`: a barrier that gates whether the `handler` may run (defaults to `true`). While `false`, every execution is blocked (initial fetch, `execute`/`refresh`, and watch triggers), and switching `true` → `false` cancels any in-flight request without clearing `data`. Re-enabling does not refetch on its own.
|
|
165
166
|
|
|
166
167
|
::note
|
|
167
168
|
Under the hood, `lazy: false` uses `<Suspense>` to block the loading of the route before the data has been fetched. Consider using `lazy: true` and implementing a loading state instead for a snappier user experience.
|
|
@@ -191,6 +192,7 @@ The following options **can differ** without triggering warnings:
|
|
|
191
192
|
- `immediate`
|
|
192
193
|
- `dedupe`
|
|
193
194
|
- `watch`
|
|
195
|
+
- `enabled`
|
|
194
196
|
|
|
195
197
|
```ts
|
|
196
198
|
// ❌ This will trigger a development warning
|
|
@@ -254,6 +256,7 @@ type AsyncDataOptions<DataT> = {
|
|
|
254
256
|
watch?: MultiWatchSources
|
|
255
257
|
getCachedData?: (key: string, nuxtApp: NuxtApp, ctx: AsyncDataRequestContext) => DataT | undefined
|
|
256
258
|
timeout?: number
|
|
259
|
+
enabled?: MaybeRefOrGetter<boolean>
|
|
257
260
|
}
|
|
258
261
|
|
|
259
262
|
type AsyncDataRequestContext = {
|