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

fix: setProps() throws an error if the property is the same reference #791

Merged
merged 2 commits into from
Jul 5, 2018

Conversation

mya-ake
Copy link
Contributor

@mya-ake mya-ake commented Jul 3, 2018

Related: #761, #787

Changes

  • setProps() throws an error if the property is the same reference
  • Added test that props are the same reference

Please tell me if there is a better error message.

Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests look good to me. Shame there isn't a nice way to merge newly set props with existing ones (maybe in a future update or something!)

Will be good to have this error message at least, to help guide people having the same problem you did

data[key] === this.vm[key]
) {
throwError(
`wrapper.setProps() called with ${key} property ` +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reword:
wrapper.setProps() called with the same object of the existing ${key} property. You must call wrapper.setProps() with a new object to trigger reactivity

@mya-ake
Copy link
Contributor Author

mya-ake commented Jul 4, 2018

@eddyerburgh
Thanks!
Updated the message.

Copy link
Member

@eddyerburgh eddyerburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@eddyerburgh eddyerburgh merged commit bf655f3 into vuejs:dev Jul 5, 2018
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

Successfully merging this pull request may close these issues.

3 participants