structuredClone shortens sparse arrays with trailing holes
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den React Native-Polyfill für structuredClone zu finden, und reproduziere das Problem mit einem Sparse-Array wie new Array(3), bei dem nur der Index 1 befüllt ist. Überprüfe, dass der Klon die Länge der Quelle und die nachfolgenden Lücken beibehält, entsprechend dem Verhalten von Node's nativer structuredClone-Implementierung.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react-native
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Aktiv
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 72/100