react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

Expand renderToPipeableStream()’s documentation

Open RoyalIcing opened this issue 3 years ago • 4 comments

The documentation to renderToPipeableStream() is a sparse. For example, the current documentation links out the React source code for a full list of options. It also doesn’t explain that you can opt-out of the inline <script> approach by using the onAllReady callback.

This is a draft that I hope can be iterated on to clarify and expand the documentation. I won’t be offended if you don’t like my long headings or how I’ve structure it. I hope it provides a good first step to explain the core behaviour.

See: https://twitter.com/dan_abramov/status/1521297849593614339

Note that some terms seem interchangeable. I’ve tried using “ready” as that what the callbacks are named. It perhaps would be helpful to settle on canonical terms for:

  • Suspended content blocks vs suspended content boundaries
  • Ready vs Resolved vs Loaded vs Unsuspended
  • Initial HTML vs Initial HTML shell

RoyalIcing avatar May 03 '22 02:05 RoyalIcing

Size Changes

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

This PR introduced no changes to the javascript bundle 🙌

github-actions[bot] avatar May 03 '22 02:05 github-actions[bot]

BTW in a quick search for usage of this function I didn’t find many examples of people “doing it right” with regards to error handling so I feel that documentation might help here: https://github.com/search?q=renderToPipeableStream&type=code

RoyalIcing avatar May 03 '22 02:05 RoyalIcing

I have created a little project to test renderToPipeableStream() in different scenarios: https://github.com/BurntCaramel/renderToPipeableStreamPlayground

RoyalIcing avatar May 04 '22 06:05 RoyalIcing

There might be some new stuff to document from the 18.2.0 release: https://github.com/facebook/react/releases/tag/v18.2.0

RoyalIcing avatar Jun 15 '22 02:06 RoyalIcing

Addressed this via https://github.com/reactjs/reactjs.org/pull/5339. Thank you for starting this.

gaearon avatar Dec 09 '22 17:12 gaearon