There is a defect in the ref in proxyWithHistory #725
Replies: 3 comments 6 replies
-
deepClone in proxyWithHistory wants keywords for ref not to be converted to a proxy structure const deepClone = <T>(obj: T): T => {
if (!isObject(obj)) {
return obj
}
const baseObject: T = Array.isArray(obj)
? []
: Object.create(Object.getPrototypeOf(obj))
Reflect.ownKeys(obj).forEach((key) => {
if (key === 'ref') {
baseObject[key as keyof T] = Reflect.get(obj, key);
} else {
baseObject[key as keyof T] = deepClone(obj[key as keyof T]);
}
})
return baseObject
} |
Beta Was this translation helpful? Give feedback.
-
Yeah, we found proxyWithHistory doesn't cover all cases. |
Beta Was this translation helpful? Give feedback.
-
Not sure I get it. Can you reproduce it with very simple setup? Creating a repro with https://codesandbox.io/s/react-new would be good. |
Beta Was this translation helpful? Give feedback.
-
An error was reported when a ref property was recovered using the proxyWithHistory component
Please include a minimal reproduction.
For details, go to add -> undo -> redo
Beta Was this translation helpful? Give feedback.
All reactions