Commit 437fb2cb authored by Naoyuki Kanezawa's avatar Naoyuki Kanezawa Committed by Arunoda Susiripala

Copy all properties and descriptors when patching React (#1101)

* patch-react: copy non-enumerable properties and descriptors

* fix syntax error

* remove getOwnPropertyDescriptors polyfil
parent 2c85b367
...@@ -105,11 +105,11 @@ function wrap (fn, around) { ...@@ -105,11 +105,11 @@ function wrap (fn, around) {
return around.call(this, fn, ...args) return around.call(this, fn, ...args)
} }
// copy all properties for (const [k, d] of Object.entries(Object.getOwnPropertyDescriptors(fn))) {
Object.assign(_fn, fn) try {
_fn.displayName = fn.displayName || fn.name Object.defineProperty(_fn, k, d)
} catch (e) {}
_fn.prototype = fn.prototype }
_fn.__wrapped = fn.__wrapped = _fn _fn.__wrapped = fn.__wrapped = _fn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment