reactjs / reactjs/react.dev

[Question] about "._owner.alternate"

オープン
#1,919 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

It seems that in react@16 every React element children contains cyclic property ._owner.alternate.alternate.alternate.alternate....

image

So it is easy to cause "Maximum call stack exceeded" error when developer compares props.children in deep way(like deep-equal).

This caused bugs for community libraries like react-helmet:
https://github.com/nfl/react-helmet/issues/441

I am extremely curious about:
Why React has _owner.alternate, and what it stands for?
As it is named as “_owner”, could it be better if we make “owner” not enumerable?

I tried to search source code and but still can’t find any clue.

Thanks in advance.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ファイルもテストも指定されていません。まず、要素の子と _owner.alternate チェーンを作成する React 16 のソースを追跡し、次にリンクされた react-helmet issue 441 を確認します。完了条件は、_owner.alternate が何を表すのかを文書化し、enumerable owner に関する懸念に文書化された変更が必要かどうかを解決することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react
領域
documentation
issue の種類
ドキュメント
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。