mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 01:17:16 +00:00
fix(nuxt3): keep nuxtApp
instance in client-side (#2114)
This commit is contained in:
parent
650f14bc42
commit
7e5e50bba7
@ -180,7 +180,10 @@ export const setNuxtAppInstance = (nuxt: NuxtApp | null) => {
|
|||||||
export function callWithNuxt<T extends () => any> (nuxt: NuxtApp, setup: T) {
|
export function callWithNuxt<T extends () => any> (nuxt: NuxtApp, setup: T) {
|
||||||
setNuxtAppInstance(nuxt)
|
setNuxtAppInstance(nuxt)
|
||||||
const p: ReturnType<T> = setup()
|
const p: ReturnType<T> = setup()
|
||||||
|
if (process.server) {
|
||||||
|
// Unset nuxt instance to prevent context-sharing in server-side
|
||||||
setNuxtAppInstance(null)
|
setNuxtAppInstance(null)
|
||||||
|
}
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user