Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

structuredClone shortens sparse arrays with trailing holes

未關閉 適合新手
#58,208 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, react-native
領域
mobile

研究方向

先定位 React Native 的 structuredClone polyfill,並使用類似 new Array(3) 的稀疏陣列重現問題,其中只有索引 1 被填入值。確認複製結果保留來源的長度和末尾的空洞,符合 Node 原生 structuredClone 的行為。

由索引模型根據 Issue 內容生成。

描述

Needs: Author Feedback Needs: Repro
Description

The React Native structuredClone polyfill initializes an array clone as [] and only assigns enumerable keys. If a sparse array's highest populated index precedes its declared length, the trailing holes are lost and the clone is silently shortened. For example, new Array(3) with only index 1 populated becomes length 2.

Expected behavior

The clone should preserve the source array's declared length and holes. Node's native structuredClone follows this behavior.

React Native Version

0.87.1 and current main

Affected Platforms

JavaScript runtime - All

主要語言
C++
星號
127k
分支
25.3k
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

react/react-native 的其他 Issue

查看 react/react-native 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。