mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-28 00:22:05 +00:00
refactor: export AsyncDataStrategy
This commit is contained in:
parent
6abab412ad
commit
8e18c1bdc0
@ -31,6 +31,8 @@ export type KeyOfRes<Transform extends _Transform> = KeysOf<ReturnType<Transform
|
|||||||
|
|
||||||
export type MultiWatchSources = (WatchSource<unknown> | object)[]
|
export type MultiWatchSources = (WatchSource<unknown> | object)[]
|
||||||
|
|
||||||
|
export type AsyncDataStrategy = 'lazy' | 'parallel' | 'blocking'
|
||||||
|
|
||||||
export interface AsyncDataOptions<
|
export interface AsyncDataOptions<
|
||||||
ResT,
|
ResT,
|
||||||
DataT = ResT,
|
DataT = ResT,
|
||||||
@ -40,7 +42,7 @@ export interface AsyncDataOptions<
|
|||||||
server?: boolean
|
server?: boolean
|
||||||
/** @deprecated Use strategy: 'lazy' */
|
/** @deprecated Use strategy: 'lazy' */
|
||||||
lazy?: boolean
|
lazy?: boolean
|
||||||
strategy?: 'lazy' | 'parallel' | 'blocking'
|
strategy?: AsyncDataStrategy
|
||||||
default?: () => DefaultT | Ref<DefaultT>
|
default?: () => DefaultT | Ref<DefaultT>
|
||||||
transform?: _Transform<ResT, DataT>
|
transform?: _Transform<ResT, DataT>
|
||||||
pick?: PickKeys
|
pick?: PickKeys
|
||||||
|
@ -14,7 +14,7 @@ import type { RenderResponse } from 'nitropack'
|
|||||||
import type { NuxtIslandContext } from '../core/runtime/nitro/renderer'
|
import type { NuxtIslandContext } from '../core/runtime/nitro/renderer'
|
||||||
import type { RouteMiddleware } from '../../app'
|
import type { RouteMiddleware } from '../../app'
|
||||||
import type { NuxtError } from '../app/composables/error'
|
import type { NuxtError } from '../app/composables/error'
|
||||||
import type { AsyncDataOptions, AsyncDataRequestStatus } from '../app/composables/asyncData'
|
import type { AsyncDataRequestStatus, AsyncDataStrategy } from '../app/composables/asyncData'
|
||||||
|
|
||||||
const nuxtAppCtx = /* #__PURE__ */ getContext<NuxtApp>('nuxt-app')
|
const nuxtAppCtx = /* #__PURE__ */ getContext<NuxtApp>('nuxt-app')
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ interface _NuxtApp {
|
|||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_asyncDataPromises: Record<string, Promise<any> & { strategy?: AsyncDataOptions<any>['strategy'] } | undefined>
|
_asyncDataPromises: Record<string, Promise<any> & { strategy?: AsyncDataStrategy } | undefined>
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_asyncData: Record<string, {
|
_asyncData: Record<string, {
|
||||||
data: Ref<any>
|
data: Ref<any>
|
||||||
|
Loading…
Reference in New Issue
Block a user