Suspense documentation incorrectly conflates `componentDidMount` with "component has rendered on the screen"
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the “Approach 1” section in the linked Suspense documentation and compare its description of componentDidMount with the clarification in issue #9117. Update the wording so mounting into a DOM node is not equated with being attached to the document or visible on screen; done when the fetch-on-render explanation is accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100