Skip to content

Class extends work a bit wrong #199

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

Closed
fimars opened this issue Nov 28, 2017 · 4 comments · Fixed by #200
Closed

Class extends work a bit wrong #199

fimars opened this issue Nov 28, 2017 · 4 comments · Fixed by #200
Labels

Comments

@fimars
Copy link

fimars commented Nov 28, 2017

Background

// base input component
@Component({
  template: require('any.html')
})
export class InputComponent extends Vue {
  // ...something doesn't important

  @Watch('value')
  private valueChange(newVal: string | number, oldVal: string | number) {
    this.setCurrentValue(newVal);
  }
}
// a mock component for test
@Component({
  template: require('any.html'),
})
class MockComponent extends InputComponent {
  constructor() {
    super();
  }
}

How

default

Work very well, but have a bit weird. The MockInputComponent have two duplicate content,
caused his watcher to be triggered twice.

Like this:
default

Am I doing something wrong?

@fimars fimars changed the title class extends work a bit wrong Class extends work a bit wrong Nov 28, 2017
@ktsn
Copy link
Member

ktsn commented Nov 28, 2017

Could you provide self-contained reproduction?

@HerringtonDarkholme
Copy link
Member

I guess the problem comes from here.

https://github.com/vuejs/vue-class-component/blob/master/src/component.ts#L58

And here

https://github.com/vuejs/vue-class-component/blob/master/src/util.ts#L22-L28

Note __decorator__ is inherited, every time @Component call will add inherited decorators again, thus duplication happens.

@fimars
Copy link
Author

fimars commented Nov 28, 2017

@HerringtonDarkholme I agree your guess. @ktsn Here is a reproduction jsfiddle.

PS: This example works very well another example.

@ktsn ktsn added bug and removed need repro labels Nov 28, 2017
@ktsn
Copy link
Member

ktsn commented Nov 28, 2017

Thanks for the repro. This seems a regression caused by static member forwarding that introduced in v6.1.0.

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

Successfully merging a pull request may close this issue.

3 participants