Suspense documentation incorrectly conflates `componentDidMount` with "component has rendered on the screen"
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 11.8k
- Forks
- 7.9k
- Ø Merge
- 1 T. 11 Std.
- Gemergte PRs (30 T.)
- 11
Beschreibung
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.
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
Öffne den Abschnitt „Approach 1“ in der verlinkten Suspense-Dokumentation und vergleiche dessen Beschreibung von componentDidMount mit der Klarstellung in issue #9117. Aktualisiere die Formulierung so, dass das Mounten in einen DOM-Knoten nicht damit gleichgesetzt wird, an das Dokument angehängt oder auf dem Bildschirm sichtbar zu sein; die Arbeit ist erledigt, wenn die Erklärung von fetch-on-render korrekt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 50/100