Skip to content

Commit fe46727

Browse files
committed
Update vendored React packages to next-41110021f
Notable changes: - Bugfix: Selective hydration causing incorrect thenable type passed to DevTools facebook/react#26275 - Bugfix: Crash when a hook is called after `use(promise)` facebook/react#26232 - Support type for ReactDOM.preload() options facebook/react#26239 - Implement preconnect and prefetchDNS methods facebook/react#26237
1 parent fcfab17 commit fe46727

30 files changed

+1822
-1168
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@
189189
"random-seed": "0.3.0",
190190
"react": "18.2.0",
191191
"react-17": "npm:[email protected]",
192-
"react-builtin": "npm:[email protected]bfb9cbd8c-20230223",
192+
"react-builtin": "npm:[email protected]41110021f-20230301",
193193
"react-dom": "18.2.0",
194194
"react-dom-17": "npm:[email protected]",
195-
"react-dom-builtin": "npm:[email protected]bfb9cbd8c-20230223",
196-
"react-server-dom-webpack": "18.3.0-next-bfb9cbd8c-20230223",
195+
"react-dom-builtin": "npm:[email protected]41110021f-20230301",
196+
"react-server-dom-webpack": "18.3.0-next-41110021f-20230301",
197197
"react-ssr-prepass": "1.0.8",
198198
"react-virtualized": "9.22.3",
199199
"relay-compiler": "13.0.2",

packages/next/src/compiled/babel-packages/packages-bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
1717
var React = require('react');
1818
var ReactDOM = require('react-dom');
1919

20-
var ReactVersion = '18.3.0-next-bfb9cbd8c-20230223';
20+
var ReactVersion = '18.3.0-next-41110021f-20230301';
2121

2222
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2323

@@ -2007,6 +2007,8 @@ var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL
20072007

20082008
var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher;
20092009
var ReactDOMServerDispatcher = {
2010+
prefetchDNS: prefetchDNS,
2011+
preconnect: preconnect,
20102012
preload: preload,
20112013
preinit: preinit
20122014
} ;
@@ -4551,7 +4553,10 @@ function writePreamble(destination, resources, responseState, willFlushAllSegmen
45514553
writeChunk(destination, charsetChunks[i]);
45524554
}
45534555

4554-
charsetChunks.length = 0;
4556+
charsetChunks.length = 0; // emit preconnect resources
4557+
4558+
resources.preconnects.forEach(flushResourceInPreamble, destination);
4559+
resources.preconnects.clear();
45554560
var preconnectChunks = responseState.preconnectChunks;
45564561

45574562
for (i = 0; i < preconnectChunks.length; i++) {
@@ -4624,6 +4629,8 @@ function writeHoistables(destination, resources, responseState) {
46244629
// We omit charsetChunks because we have already sent the shell and if it wasn't
46254630
// already sent it is too late now.
46264631

4632+
resources.preconnects.forEach(flushResourceLate, destination);
4633+
resources.preconnects.clear();
46274634
var preconnectChunks = responseState.preconnectChunks;
46284635

46294636
for (i = 0; i < preconnectChunks.length; i++) {
@@ -4911,9 +4918,11 @@ function createResources() {
49114918
return {
49124919
// persistent
49134920
preloadsMap: new Map(),
4921+
preconnectsMap: new Map(),
49144922
stylesMap: new Map(),
49154923
scriptsMap: new Map(),
49164924
// cleared on flush
4925+
preconnects: new Set(),
49174926
fontPreloads: new Set(),
49184927
// usedImagePreloads: new Set(),
49194928
precedences: new Map(),
@@ -4939,6 +4948,98 @@ function getResourceKey(as, href) {
49394948
return "[" + as + "]" + href;
49404949
}
49414950

4951+
function prefetchDNS(href, options) {
4952+
if (!currentResources) {
4953+
// While we expect that preconnect calls are primarily going to be observed
4954+
// during render because effects and events don't run on the server it is
4955+
// still possible that these get called in module scope. This is valid on
4956+
// the client since there is still a document to interact with but on the
4957+
// server we need a request to associate the call to. Because of this we
4958+
// simply return and do not warn.
4959+
return;
4960+
}
4961+
4962+
var resources = currentResources;
4963+
4964+
{
4965+
if (typeof href !== 'string' || !href) {
4966+
error('ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
4967+
} else if (options != null) {
4968+
if (typeof options === 'object' && options.hasOwnProperty('crossOrigin')) {
4969+
error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
4970+
} else {
4971+
error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
4972+
}
4973+
}
4974+
}
4975+
4976+
if (typeof href === 'string' && href) {
4977+
var key = getResourceKey('prefetchDNS', href);
4978+
var resource = resources.preconnectsMap.get(key);
4979+
4980+
if (!resource) {
4981+
resource = {
4982+
type: 'preconnect',
4983+
chunks: [],
4984+
state: NoState,
4985+
props: null
4986+
};
4987+
resources.preconnectsMap.set(key, resource);
4988+
pushLinkImpl(resource.chunks, {
4989+
href: href,
4990+
rel: 'dns-prefetch'
4991+
});
4992+
}
4993+
4994+
resources.preconnects.add(resource);
4995+
}
4996+
}
4997+
function preconnect(href, options) {
4998+
if (!currentResources) {
4999+
// While we expect that preconnect calls are primarily going to be observed
5000+
// during render because effects and events don't run on the server it is
5001+
// still possible that these get called in module scope. This is valid on
5002+
// the client since there is still a document to interact with but on the
5003+
// server we need a request to associate the call to. Because of this we
5004+
// simply return and do not warn.
5005+
return;
5006+
}
5007+
5008+
var resources = currentResources;
5009+
5010+
{
5011+
if (typeof href !== 'string' || !href) {
5012+
error('ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
5013+
} else if (options != null && typeof options !== 'object') {
5014+
error('ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.', getValueDescriptorExpectingEnumForWarning(options));
5015+
} else if (options != null && typeof options.crossOrigin !== 'string') {
5016+
error('ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.', getValueDescriptorExpectingObjectForWarning(options.crossOrigin));
5017+
}
5018+
}
5019+
5020+
if (typeof href === 'string' && href) {
5021+
var crossOrigin = options == null || typeof options.crossOrigin !== 'string' ? null : options.crossOrigin === 'use-credentials' ? 'use-credentials' : '';
5022+
var key = "[preconnect][" + (crossOrigin === null ? 'null' : crossOrigin) + "]" + href;
5023+
var resource = resources.preconnectsMap.get(key);
5024+
5025+
if (!resource) {
5026+
resource = {
5027+
type: 'preconnect',
5028+
chunks: [],
5029+
state: NoState,
5030+
props: null
5031+
};
5032+
resources.preconnectsMap.set(key, resource);
5033+
pushLinkImpl(resource.chunks, {
5034+
rel: 'preconnect',
5035+
href: href,
5036+
crossOrigin: crossOrigin
5037+
});
5038+
}
5039+
5040+
resources.preconnects.add(resource);
5041+
}
5042+
}
49425043
function preload(href, options) {
49435044
if (!currentResources) {
49445045
// While we expect that preload calls are primarily going to be observed
@@ -5219,7 +5320,8 @@ function preloadPropsFromPreloadOptions(href, as, options) {
52195320
as: as,
52205321
href: href,
52215322
crossOrigin: as === 'font' ? '' : options.crossOrigin,
5222-
integrity: options.integrity
5323+
integrity: options.integrity,
5324+
type: options.type
52235325
};
52245326
}
52255327

0 commit comments

Comments
 (0)