-
-
Notifications
You must be signed in to change notification settings - Fork 862
Closed
Labels
Description
🐛 Bug Report
When you use produce
on an object which contains a symbol property which is an object, it leaks Proxy
object into returned value.
Link to repro
https://codesandbox.io/p/sandbox/suspicious-sanne-2ypqwt
To Reproduce
- Get an object with symbol:
const sym = Symbol()
let state = {
id: 1,
[sym]: {} // must be an object
}
-
Use it with
produce
and readstate[sym]
value inside draft function. In returned valuestate[sym]
object will be a revoked proxy instead of plain object. -
Use it with
produce
again. Now an error will be thrown becausestate[sym]
is corrupted.
TypeError
Cannot perform 'getPrototypeOf' on a proxy that has been revoked
Observed behavior
Proxy object is leaking out of produce
function.
Expected behavior
Plain object should be returned instead.
Environment
The bug appears since 10.0.0 version. It works fine in 9.0.21 version.