vue-hot-reload-api icon indicating copy to clipboard operation
vue-hot-reload-api copied to clipboard

rerender throws an exception when component options are missing a render function

Open BrightSoul opened this issue 5 years ago • 0 comments
trafficstars

Hi everyone, I'm having an issue with rerender.

In the readme.md file, you provided a sample component options.

const myComponentOptions = {
  data () { ... },
  created () { ... },
  render () { ... }
}

However, my object does not have a render function. It's using a template, instead. Here's a sample:

const componentOptions = {
  data() { return { foo: 'bar' }; },
  template: '<div>foo value is: {{ foo }}</div>'
};

When I try to rerender it, an exception occurs because the render function is missing.

vue-rerender

The reload method is working perfectly fine though.

Here's a repro: https://github.com/BrightSoul/vue-hot-reload-api-issue-repro

I am aware that an easy solution to this is to just rewrite my component options like this:

const componentOptions = {
  data() { return { foo: 'bar' }; },
  ...Vue.compile('<div>foo value is: {{ foo }}</div>')
};

But I was wondering whether the difference in behavior between reload and rerender is intended or not.

BrightSoul avatar Nov 08 '20 14:11 BrightSoul