Skip to content

Commit 13b7231

Browse files
authored
refactor(reactivity): use hasChanged to avoid tracking NaN key twice (#7378)
1 parent b401243 commit 13b7231

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/reactivity/src/collectionHandlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function get(
2727
const rawTarget = toRaw(target)
2828
const rawKey = toRaw(key)
2929
if (!isReadonly) {
30-
if (key !== rawKey) {
30+
if (hasChanged(key, rawKey)) {
3131
track(rawTarget, TrackOpTypes.GET, key)
3232
}
3333
track(rawTarget, TrackOpTypes.GET, rawKey)
@@ -50,7 +50,7 @@ function has(this: CollectionTypes, key: unknown, isReadonly = false): boolean {
5050
const rawTarget = toRaw(target)
5151
const rawKey = toRaw(key)
5252
if (!isReadonly) {
53-
if (key !== rawKey) {
53+
if (hasChanged(key, rawKey)) {
5454
track(rawTarget, TrackOpTypes.HAS, key)
5555
}
5656
track(rawTarget, TrackOpTypes.HAS, rawKey)

0 commit comments

Comments
 (0)