-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve script loading when streaming is enabled #31338
Comments
2 tasks
10 tasks
kodiakhq bot
pushed a commit
that referenced
this issue
Dec 13, 2021
This PR implements the basic inline embedded server response data (#30994) for RSC, as well as partial hydration (#31338) for RSC and React 18 SSR streaming. For #30994, `renderTargetSuffix` is passed to the `bodyResult` resolver so the stream can inject corresponding hydration scripts and the closing body tag at the correct time. The expected behavior should be _prefix_, _body shell_, _suffix scripts_, _stream and inlined data_, _close body_. For #31338, we have to force turn on `disableOptimizedLoading` when `concurrentFeatures` is enabled to opt-out of deferred script tags. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
cdierkens
pushed a commit
to cdierkens/next.js
that referenced
this issue
Dec 20, 2021
This PR implements the basic inline embedded server response data (vercel#30994) for RSC, as well as partial hydration (vercel#31338) for RSC and React 18 SSR streaming. For vercel#30994, `renderTargetSuffix` is passed to the `bodyResult` resolver so the stream can inject corresponding hydration scripts and the closing body tag at the correct time. The expected behavior should be _prefix_, _body shell_, _suffix scripts_, _stream and inlined data_, _close body_. For vercel#31338, we have to force turn on `disableOptimizedLoading` when `concurrentFeatures` is enabled to opt-out of deferred script tags. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the feature you'd like to request
A while ago we changed the default script loading strategy to use
defer
in #24939. However this doesn’t work well within the streaming model since deferred scripts will only be executed after finishing the full HTML. This makes selective hydration kinda useless because there is no way to hydrate early.Describe the solution you'd like
That said, it would be great to switch back to the
async
strategy for the runtime and modules whenconcurrentFeatures
is enabled, and leverage thebootstrapScripts
option (facebook/react#22594) to inject them at the right time.And finally, a
<link rel=preload>
tag might also be necessary to maximize performance.Describe alternatives you've considered
As a workaround, you can also use the
disableOptimizedLoading
flag to manually switch back to theasync
strategy. But it can’t start hydration with the perfect timing.The text was updated successfully, but these errors were encountered: