reactjs / reactjs/react.dev

[Question] about "._owner.alternate"

未关闭
#1,919 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
11.8k
派生
7.9k
平均合并
1 天 11 小时
30 天内合并 PR
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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 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 摘要。