react / react/react-native

structuredClone loses ArrayBuffer and typed-array data

Open
#58,218 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs: Author Feedback Needs: Repro
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Description

The React Native structuredClone polyfill treats ArrayBuffer, DataView, and every typed array as arbitrary objects, returning plain objects that lose their internal bytes, view type, offsets, lengths, and shared backing-buffer relationships.

Expected behavior

ArrayBuffers should be copied through the intrinsic operation; DataView and all supported typed-array kinds should be reconstructed with their original offset/length and should share the same cloned backing buffer when cloned together. User-shadowed slice or constructor properties must not be invoked. Transfer support is outside this issue.

React Native Version

0.87.1 and current main

Affected Platforms

JavaScript runtime - All

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the structuredClone polyfill on current main and first reproduce the issue with ArrayBuffer, DataView, and typed arrays, including shared backing buffers and shadowed properties. Trace the existing object-cloning path and its tests. Done means these built-in views retain their bytes, type, offsets, lengths, and relationships without invoking shadowed slice or constructor properties; transfer support remains out of scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.