-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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 reactive objects which are sealed #7080
Conversation
I'm not sure what you mean by
Can you give an example? I don't think it makes sense to change Vue internals to cater to a specific userland use case. |
A simple example is a The current code has the assumption "a sealed object can never be reactive". Imho this is an assumption that does not hold universally. I don't see that as a specific use case. It is rather an unnecessary constraint that Vue currently has. |
The extensible check was added to avoid unnecessary perf cost of traversing objects that are known to be frozen. Are you trying to create objects that are frozen only on itself, but allowing deep mutations inside? I feel that really complicates things. FYI in 2.5+ |
It still fails silently if the property name is wrong. It sets the new property and makes it reactive, but this is not the property the developer intended to set.
No. I am not freezing the objects, I only seal them, so new properties can not be added but existing ones can be modified. What about using |
I have changed the PR accordingly. Please take another look. Is this better? |
|
You probably tested it on an empty object, which I also did initially. A sealed empty object is effectively frozen, since there is no property that could change. On non-empty objects it works as expected:
|
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
I am using this helper method to seal my objects before passing them to Vue:
This turns silent errors into nice verbose errors, for example when there is a mistake in a Vue template. The function changed by this PR is currently preventing this from working correctly.