-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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(reactivity): check rawValue exists in target via set.add vuejs#8647 #12393
base: main
Are you sure you want to change the base?
Conversation
expect(observedSet.size).toBe(1) | ||
|
||
const observedMap = reactive(new Map()) | ||
observedMap.set('key', observed) |
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.
The test case for Map.set
here is incorrect because you only modified add
without changing set
. I think this part of the test would pass even without this PR. Additionally, the observedMap
should have an initial value like observedSet
const target = toRaw(this) | ||
const proto = getProto(target) | ||
const hadKey = proto.has.call(target, value) | ||
// 先获取原始值 |
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.
this comment seems unnecessary
const target = toRaw(this) | ||
const proto = getProto(target) | ||
const hadKey = proto.has.call(target, value) | ||
// 先获取原始值 | ||
const rawValue = |
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.
const rawValue = | |
const valueToAdd = |
The following operation doesn't always return a raw value.
fix #8647