Description
The React Native structuredClone polyfill reuses one module-global memory map under the assumption that cloning does not invoke user code. Enumerable property getters do execute, however, and can call structuredClone recursively. The inner call's finally clears the outer clone's memory, so later circular references are cloned again instead of pointing to the outer result.
Expected behavior
Each reentrant clone should have independent cycle-detection memory, while ordinary non-reentrant calls may retain the existing reusable-map optimization.
React Native Version
0.87.1 and current main
Affected Platforms
JavaScript runtime - All
Description
The React Native
structuredClonepolyfill reuses one module-global memory map under the assumption that cloning does not invoke user code. Enumerable property getters do execute, however, and can callstructuredClonerecursively. The inner call'sfinallyclears the outer clone's memory, so later circular references are cloned again instead of pointing to the outer result.Expected behavior
Each reentrant clone should have independent cycle-detection memory, while ordinary non-reentrant calls may retain the existing reusable-map optimization.
React Native Version
0.87.1 and current main
Affected Platforms
JavaScript runtime - All