fix(reactivity): Map/Set identity methods should work even if raw value contains reactive entries
fix #799
This commit is contained in:
@@ -23,7 +23,14 @@ const arrayInstrumentations: Record<string, Function> = {}
|
||||
for (let i = 0, l = (this as any).length; i < l; i++) {
|
||||
track(arr, TrackOpTypes.GET, i + '')
|
||||
}
|
||||
return arr[key](...args.map(toRaw))
|
||||
// we run the method using the orignal args first (which may be reactive)
|
||||
const res = arr[key](...args)
|
||||
if (res === -1 || res === false) {
|
||||
// if that didn't work, run it again using raw values.
|
||||
return arr[key](...args.map(toRaw))
|
||||
} else {
|
||||
return res
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user