mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
fix(nuxt): call data refresh hook in parallel (#8470)
This commit is contained in:
parent
91eab1b312
commit
1d795f0274
@ -264,12 +264,12 @@ export function useLazyAsyncData<
|
|||||||
return useAsyncData(key, handler, { ...options, lazy: true }, null)
|
return useAsyncData(key, handler, { ...options, lazy: true }, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function refreshNuxtData (keys?: string | string[]): Promise<void> {
|
export async function refreshNuxtData (keys?: string | string[]): Promise<void> {
|
||||||
if (process.server) {
|
if (process.server) {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
const _keys = keys ? Array.isArray(keys) ? keys : [keys] : undefined
|
const _keys = keys ? Array.isArray(keys) ? keys : [keys] : undefined
|
||||||
return useNuxtApp().callHook('app:data:refresh', _keys)
|
await useNuxtApp().hooks.callHookParallel('app:data:refresh', _keys)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clearNuxtData (keys?: string | string[] | ((key: string) => boolean)): void {
|
export function clearNuxtData (keys?: string | string[] | ((key: string) => boolean)): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user