reactjs / reactjs/react.dev

Suspense documentation incorrectly conflates `componentDidMount` with "component has rendered on the screen"

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

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

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

説明

In the "Approach 1" section:

We call this approach “fetch-on-render” because it doesn’t start fetching until after the component has rendered on the screen. This leads to a problem known as a “waterfall”.

However, @gaearon has previously clarified out that componentDidMount only guarantees that the React tree has been mounted onto a DOM node, not that that DOM node is attached to the document/visible on screen: https://github.com/facebook/react/issues/9117#issuecomment-284228870

The componentDidMount would fire because the mounting has happened. However, as you can see, the div I’m mounting into is not actually part of the page’s DOM. Therefore, the component’s DOM node is also not in the document even though it has mounted into its container.

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

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

はじめの一歩

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

調査の方向性

リンクされた Suspense ドキュメントの「Approach 1」セクションを開き、componentDidMount の説明を issue #9117 の補足と比較してください。DOM ノードへのマウントが、ドキュメントへのアタッチや画面上での表示と同一視されないように文言を更新してください。fetch-on-render の説明が正確になったら完了です。

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

評価

技術スタック
javascript, react
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
50/100

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

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