Vue-meta: Cannot read property 'hasOwnProperty' of undefined

Created on 25 Oct 2018  路  4Comments  路  Source: nuxt/vue-meta

Running "vue-meta": "^1.5.5"

Cannot read property 'hasOwnProperty' of undefined on some route changes, not consistent. I have seen Cannot read property 'title' of undefined on previous versions, might be related.

Project based on https://github.com/vuejs/vue-hackernews-2.0

affected section in vue-meta.js:

```// collect & aggregate child options if deep = true
if (deep && component.$children.length) {
component.$children.forEach(function (childComponent) {
result = getComponentOption({
component: childComponent,
option: option,
deep: deep,
arrayMerge: arrayMerge
}, result);
});
}
if (metaTemplateKeyName && result.hasOwnProperty('meta')) {
result.meta = Object.keys(result.meta).map(function (metaKey) {
var metaObject = result.meta[metaKey];
if (!metaObject.hasOwnProperty(metaTemplateKeyName) || !metaObject.hasOwnProperty(contentKeyName) || typeof metaObject[metaTemplateKeyName] === 'undefined') {
return result.meta[metaKey]
}

  var template = metaObject[metaTemplateKeyName];
  delete metaObject[metaTemplateKeyName];

  if (template) {
    metaObject.content = typeof template === 'function' ? template(metaObject.content) : template.replace(/%s/g, metaObject.content);
  }

  return metaObject
});

}
return result
}

bug v2

Most helpful comment

When testing this it seems to be triggered by not returning anything from metaInfo (or head in nuxt) as mentioned in the linked issue

All 4 comments

Hi Wilco, did you find a solution ? I'm running into the same issue.

Needs reproduction.

When testing this it seems to be triggered by not returning anything from metaInfo (or head in nuxt) as mentioned in the linked issue

Closing as changes for this issue are included in the v2 release candidate. Please help us testing the release candidate and report any follow-ups in a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathanchase picture nathanchase  路  3Comments

Remcoman picture Remcoman  路  9Comments

farhodhojiev picture farhodhojiev  路  4Comments

diff-dennis picture diff-dennis  路  8Comments

DRoet picture DRoet  路  9Comments