perf(reactivity): only call Set.add if doesn't already have value (#3307)
This commit is contained in:
parent
5ad4036e29
commit
9cd988342c
@ -76,8 +76,8 @@ function add(this: SetTypes, value: unknown) {
|
|||||||
const target = toRaw(this)
|
const target = toRaw(this)
|
||||||
const proto = getProto(target)
|
const proto = getProto(target)
|
||||||
const hadKey = proto.has.call(target, value)
|
const hadKey = proto.has.call(target, value)
|
||||||
target.add(value)
|
|
||||||
if (!hadKey) {
|
if (!hadKey) {
|
||||||
|
target.add(value)
|
||||||
trigger(target, TriggerOpTypes.ADD, value, value)
|
trigger(target, TriggerOpTypes.ADD, value, value)
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
|
Loading…
Reference in New Issue
Block a user