mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 00:52:01 +00:00
fix(nuxt): defer shared asyncData promises to next tick (#27329)
This commit is contained in:
parent
5f60aa5a48
commit
0e90e87ef7
@ -229,7 +229,7 @@ export function useAsyncData<
|
||||
const value = nuxtApp.ssrContext!._sharedPrerenderCache!.get(key)
|
||||
if (value) { return value as Promise<ResT> }
|
||||
|
||||
const promise = nuxtApp.runWithContext(_handler)
|
||||
const promise = Promise.resolve().then(() => nuxtApp.runWithContext(_handler))
|
||||
|
||||
nuxtApp.ssrContext!._sharedPrerenderCache!.set(key, promise)
|
||||
return promise
|
||||
|
@ -393,7 +393,11 @@ export default defineUntypedSchema({
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
sharedPrerenderData: false,
|
||||
sharedPrerenderData: {
|
||||
async $resolve (val, get) {
|
||||
return val ?? ((await get('future') as Record<string, unknown>).compatibilityVersion === 4)
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Enables CookieStore support to listen for cookie updates (if supported by the browser) and refresh `useCookie` ref values.
|
||||
|
Loading…
Reference in New Issue
Block a user