Closed
Description
Vue version
3.4.23
Link to minimal reproduction
Steps to reproduce
- Click on the
Mutate Prop in the template(no warning, ref mutated)
button - Click on the
Mutate Prop with accessing props in the script(you will see a warning, the ref will not be mutated)
button
What is expected?
Both attempts to mutate the prop shows warning and block mutating
What is actually happening?
the Mutate Prop in the template(no warning, ref mutated)
button mutates the prop without any warnings
System Info
No response
Any additional comments?
I would like to submit two possible pull requests (PRs):
- For the main branch:
- Introduce a temporary warning when attempting to mutate data from the main branch.
- This warning will serve as an interim solution until a more permanent fix is implemented to prevent unintended data mutations.
- For the minor branch:
- Implement a fix that blocks data mutations from the minor branch.
- This fix will prevent unintended data changes, similar to the existing protection against mutating data from scripts.
- Note: This change may break existing functionality for users who directly mutate props in the template. We should communicate this potential breaking change and guide the new recommended practices.
This approach addresses the issue on both branches, providing a short-term warning for the main branch while implementing a comprehensive solution for the minor branch. However, the fix for the minor branch may require additional documentation and migration efforts due to the potential breaking change.
Looking forward to the feedback from the team.
Metadata
Metadata
Assignees
Labels
No labels