Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'hasOwnProperty' of undefined #279

Closed
wilco-superbalist opened this issue Oct 25, 2018 · 4 comments
Closed

Cannot read property 'hasOwnProperty' of undefined #279

wilco-superbalist opened this issue Oct 25, 2018 · 4 comments

Comments

@wilco-superbalist
Copy link

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:

  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
}
@arenddeboer
Copy link

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

@manniL
Copy link
Member

manniL commented Jan 24, 2019

Needs reproduction.

@pimlie
Copy link
Collaborator

pimlie commented Mar 7, 2019

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

@pimlie
Copy link
Collaborator

pimlie commented Apr 20, 2019

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

@pimlie pimlie closed this as completed Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants