2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-05-17 04:29:37 +03:00

fix: SSR active, dont use global active var due to runInNewContext: false (#668)

Meta is not reflected in the second page rendering.

Co-authored-by: hosoi-appland <hosoi@appland.co.jp>
Co-authored-by: Pim <pimlie@hotmail.com>
This commit is contained in:
Masatsugu Hosoi
2021-05-23 23:47:02 +09:00
committed by GitHub
parent 0fc2467f09
commit 6593e9272d
+3 -3
View File
@@ -23,8 +23,6 @@ import type {
export const ssrAttribute = 'data-vm-ssr'
export const active: MetaActive = reactive({})
export function addVnode (isSSR: boolean, teleports: MetaTeleports, to: string, vnodes: VNode | Array<VNode>): void {
const nodes = (isArray(vnodes) ? vnodes : [vnodes]) as Array<VNode>
@@ -84,6 +82,7 @@ export class MetaManager {
return resolver.resolve(options, contexts, active, key, pathSegments)
}
const active: MetaActive = reactive({})
const mergedObject = createMergedObject<MetaSource>(resolve, active)
// TODO: validate resolver
@@ -95,7 +94,7 @@ export class MetaManager {
app.component('Metainfo', Metainfo)
app.config.globalProperties.$metaManager = this
app.provide(metaActiveKey, active)
app.provide(metaActiveKey, this.target.context.active)
}
addMeta (metadata: MetaSource, vm?: ComponentInternalInstance): MetaProxy {
@@ -170,6 +169,7 @@ export class MetaManager {
}
render ({ slots }: { slots?: Slots } = {}): VNode[] {
const active = this.target.context.active;
// TODO: clean this method
const { isSSR } = this