-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
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 when concurrentFeatures is enabled, and leverage the bootstrapScripts 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 the async strategy. But it can’t start hydration with the perfect timing.