mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(bridge): don't call nuxt app if instance is inaccessible (#3906)
* fix(bridge): don't call nuxt app if instance is inaccessible * fix: early return if no instance, for clarity
This commit is contained in:
parent
19842ce471
commit
9ebea904f4
@ -13,10 +13,12 @@ declare module 'vue' {
|
|||||||
const metaMixin = {
|
const metaMixin = {
|
||||||
[metaConfig.mixinKey] () {
|
[metaConfig.mixinKey] () {
|
||||||
const instance = getCurrentInstance()
|
const instance = getCurrentInstance()
|
||||||
const options = instance?.type || /* nuxt2 */ instance?.proxy?.$options
|
if (!instance) { return }
|
||||||
const nuxtApp = useNuxtApp()
|
|
||||||
|
const options = instance.type || /* nuxt2 */ instance.proxy?.$options
|
||||||
if (!options || !('head' in options)) { return }
|
if (!options || !('head' in options)) { return }
|
||||||
|
|
||||||
|
const nuxtApp = useNuxtApp()
|
||||||
const source = typeof options.head === 'function'
|
const source = typeof options.head === 'function'
|
||||||
? computed(() => options.head(nuxtApp))
|
? computed(() => options.head(nuxtApp))
|
||||||
: options.head
|
: options.head
|
||||||
|
Loading…
Reference in New Issue
Block a user