1

console.log(state, original(state))

印刷:

Proxy {0: {…}} undefined

我被困住了......如果我有更多时间,我会进入源代码以找出如何重写original以不失败,但我被迫修复一个错误。

如果对象是代理对象,为什么原始返回未定义?

重要说明,这是在 redux 工具包切片函数中。

4

1 回答 1

0

Probably you mean console.log(draft, original(draft))?

In Immer 7 you will get an explicit exception if you pass in an undrafted object, rather than getting undefined back, which should help you to catch such problems earlier.

The symbol issue only occurred when using polyfilled symbols and has been fixed in Immer 7 as well.

于 2020-06-11T10:11:05.967 回答