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 proto = getProto(target)
|
||||
const hadKey = proto.has.call(target, value)
|
||||
target.add(value)
|
||||
if (!hadKey) {
|
||||
target.add(value)
|
||||
trigger(target, TriggerOpTypes.ADD, value, value)
|
||||
}
|
||||
return this
|
||||
|
Loading…
Reference in New Issue
Block a user