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

v-once throwing error before destroy a custom component #4288

Closed
marcosmoura opened this issue Nov 23, 2016 · 0 comments
Closed

v-once throwing error before destroy a custom component #4288

marcosmoura opened this issue Nov 23, 2016 · 0 comments

Comments

@marcosmoura
Copy link

marcosmoura commented Nov 23, 2016

Version and OS:

  • Vue 2.1.0
  • Webpack
  • Google Chrome

Problem:

I have the following HTML:

<md-select v-model="docs">
  <md-option v-for="doc in availableDocs" :value="doc" v-once>{{ doc }}</md-option>
</md-select>

If I use the v-once directive in the <md-option> the console throws an error. I'm using vue-router so when I try to change the url the following error occours:

Looking at the Vue source code (on the DevTools), I've found that the problem is occuring in the following function:

function destroy$1 (vnode) {
  if (!vnode.child._isDestroyed) {
    if (!vnode.data.keepAlive) {
      vnode.child.$destroy();
    } else {
      vnode.child._inactive = true;
      callHook(vnode.child, 'deactivated');
    }
  }
}

The .child property is undefined in this case and is throwing this error.

Tests

  • Some static <md-option> (without the v-for) - The same happens
  • With a HTML tag like span - Worked with and without the v-once

If I remove the v-once from the code the problem stops.

This is a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant