Description
The React Native structuredClone polyfill passes Error.cause through by reference instead of cloning it, and only copies the property when its value is truthy. Object causes therefore remain shared with the input; a circular cause points back to the original Error; and valid falsy causes such as false disappear.
Expected behavior
An own cause property should be cloned recursively, retain its non-enumerable Error property descriptor, preserve circular/shared identity within the clone, and keep falsy values. Node's native structuredClone follows this behavior.
React Native Version
0.87.1 and current main
Affected Platforms
JavaScript runtime - All
Description
The React Native
structuredClonepolyfill passesError.causethrough by reference instead of cloning it, and only copies the property when its value is truthy. Object causes therefore remain shared with the input; a circular cause points back to the original Error; and valid falsy causes such asfalsedisappear.Expected behavior
An own
causeproperty should be cloned recursively, retain its non-enumerable Error property descriptor, preserve circular/shared identity within the clone, and keep falsy values. Node's nativestructuredClonefollows this behavior.React Native Version
0.87.1 and current main
Affected Platforms
JavaScript runtime - All