Navigation Menu

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(runtime-core): ensure props definition objects are not mutated during props normalization (close: #6915) #6916

Merged
merged 1 commit into from Oct 22, 2022

Conversation

LinusBorg
Copy link
Member

@LinusBorg LinusBorg commented Oct 20, 2022

During Props normalization, we add a couple of flags to the definition object for internal purposes, so this:

{
  type: String
}

becomes this:

{
  type: String,
  0: true,
  1: false
}

The problem is that we do this to the original object provided by the developer in the component's options. This can lead to issues when the developer re-uses these objects in different places.

This PR makes a shallow copy of that object before adding those flags, so the original definition stays untouched.

close: #6915

@LinusBorg LinusBorg requested a review from antfu October 20, 2022 10:34
@antfu antfu added the ready to merge The PR is ready to be merged. label Oct 22, 2022
@LinusBorg LinusBorg merged commit 54b6ba3 into main Oct 22, 2022
@LinusBorg LinusBorg deleted the linusborg/issue-6915-no-mutate-props-df branch October 22, 2022 09:20
chrislone pushed a commit to chrislone/core that referenced this pull request Feb 4, 2023
zhangzhonghe pushed a commit to zhangzhonghe/core that referenced this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge The PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

props definition: mutating referenced object by adding array indexes
3 participants