Commit graph

8 commits

Author SHA1 Message Date
JJ Kasper
cefd9cf283
Add crawler blocking for fallback: true (#29121)
* Add crawler blocking for fallback: true

* update test

* Update check

* Add note to docs

* use browser agent for non-crawler test
2021-09-16 11:01:28 -05:00
Gerald Monaco
620ca1b06b
Update concurrent tests and enable experimental streaming (#28892)
Updates the React 18 concurrent tests to support streaming, by using webdriver (instead of cheerio) to support dynamic updates, and being more explicit about SSR vs. hydrated content.

Also enables streaming support by setting `supportsDynamicHTML: true` in `pipe(...)` for non-bot user agents.
2021-09-07 22:34:21 +00:00
Gerald Monaco
7f83e6d15d
Add RenderResult class (#28776) 2021-09-04 09:41:06 -05:00
Gerald Monaco
51559f5c64
Use zen-observable library (#28214)
Our `Observable` use has gotten sufficiently complex that it makes sense to just use a 3rd party implementation and not worry about maintaining it ourselves. As a bonus, it doesn't rely on Node APIs.
2021-08-18 03:29:43 +00:00
Gerald Monaco
c969b8172a
Add support for dynamic HTML (#28085)
Implements `renderToString` in terms of a new `renderToStream`. The former is used for legacy documents that generate the body HTML as part of `getInitialProps`. The latter will be used directly in #27794 when streaming dynamic HTML.

Since we're exposing an actual streaming response for dynamic HTML (instead of buffering with `resultFromChunks`), we use `multiplexResult` to buffer and multiplex the underlying result to multiple subscribers.
2021-08-13 19:57:04 +00:00
Gerald Monaco
d2551bbbc7
Render as a concatenation of streams (#28082)
Return the `RenderResult` as a concatenation of streams, rather than a concatenation of strings.
2021-08-13 16:40:12 +00:00
Gerald Monaco
707afe1d4d
Add RenderResult (#27319)
Adds `RenderResult`, replacing the `string` that `renderToHTML` used to return, with an `Observable`-like API that callers can use to subscribe and get a callback when chunks are available to flush, etc.

This is the last architectural change needed for streaming. There are, however, other things currently standing in the way of streaming. For example, it is common to mutate `res` in `getServerSideProps` to do routing work, or write headers, before fetching page data. This pattern effectively nullifies any advantages of streaming. I may do a follow-up PR that adds an experimental alternative for applications not using React 18, but the main purpose for this support is for Suspense and Server Components.

For that reason, there's no actual streaming here yet: instead we just flush a single chunk. A follow-up PR will add support for streaming suspense boundaries in React 18.
2021-07-27 19:18:21 +00:00
Tim Neutkens
5b9ad8da90
Move next-server directory files to server directory (#26756)
* Move next-server directory files to server directory

* Update tests

* Update paths in other places
2021-06-30 13:44:40 +02:00
Renamed from packages/next/next-server/server/utils.ts (Browse further)