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

Bug: changing prop causes rerender to lose attributes #840

Closed
rikbrowning opened this issue Nov 1, 2021 · 3 comments · Fixed by #843
Closed

Bug: changing prop causes rerender to lose attributes #840

rikbrowning opened this issue Nov 1, 2021 · 3 comments · Fixed by #843

Comments

@rikbrowning
Copy link

rikbrowning commented Nov 1, 2021

Ok bear with me this is difficult to explain. I put together a repro at https://github.com/rikbrowning/vue-comp-bug.

Essentially what happens is that when I trigger a prop change on a component it is getting re rendered but it is missing all the computed attributes from the component. The first render is perfect but any subsequent changes seem to cause it to lose those attributes.

In my example if you view the dom inspector so you can see both the Parent and Child div. Then click on the "Child" text and notice that the Parent loses it's computed attributes.

Now if you remove the composition API from the project it works as expected.

@vansant23
Copy link

I'm running into the same exact issue on my end. Everything was working fine prior to the release of version 1.3.0 five days ago. No errors appear to be thrown, but the components now appear to be getting rerendered and losing all attributes in the process.

@edwardnyc
Copy link
Contributor

edwardnyc commented Nov 2, 2021

I found the cause of the problem because your variable name is attrs, which is the attribute of ctx on Vue-composition-API @rikbrowning

@rikbrowning
Copy link
Author

Ok, but we use the same variables etc. in our Vue3 version with no issue. Whilst I understand this is good alignment to Vue3 it has introduced a breaking change to users of certain variable names which hasn't been documented.

@antfu antfu closed this as completed in #843 Nov 3, 2021
antfu added a commit that referenced this issue Nov 3, 2021
Co-authored-by: neiyichao03 <nieyichao03@kuaishou.com>
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
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 a pull request may close this issue.

3 participants