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 1 commit into from Oct 22, 2022


Copy link

@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 Oct 20, 2022
sxzz approved these changes Oct 20, 2022
antfu approved these changes Oct 22, 2022
@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
13 checks passed
@LinusBorg LinusBorg deleted the linusborg/issue-6915-no-mutate-props-df branch Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
ready to merge The PR is ready to be merged.
None yet

Successfully merging this pull request may close these issues.

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