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
refactor(reactivity): priority check if the object is invalid #10419
base: main
Are you sure you want to change the base?
Conversation
Size ReportBundles
Usages
|
target[ReactiveFlags.RAW] && | ||
!(isReadonly && target[ReactiveFlags.IS_REACTIVE]) | ||
) { | ||
const targetType = getTargetType(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the playground, using Object.freeze
to handle proxy objects will result in an error. There should be very few people who would freeze a proxy object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, Object.freeze()
is rarely used. I believe that instead of checking the cache first, we should ensure that the object is not INVALID
before considering the subsequent actions.
Although this example is peculiar, in case there is a large amount of code within a single SFC
, maintained by multiple people, if someone misuses Object.freeze()
and another person proxies the original object, an error would be thrown in the now Vue version. However, if the object is INVALID
, just return the original object directly, in your case, the error won't occur.
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
If the object is non-extensible from the beginning, return the original object directly, without the need to check the cache first.
If the original object has already been proxied and subsequently becomes non-extensible, when attempting to proxy it again, it should return the original object directly.
Removed comments and used variable names instead.