Unverified Commit 20f5db06 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Update precompiled react to next channel (#41708)

Precompile `react@next` and to unlock `cache` and `use` API
parent 95af2454
...@@ -178,11 +178,11 @@ ...@@ -178,11 +178,11 @@
"random-seed": "0.3.0", "random-seed": "0.3.0",
"react": "18.2.0", "react": "18.2.0",
"react-17": "npm:react@17.0.2", "react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@0.0.0-experimental-1d3fc9c9c-20221023", "react-builtin": "npm:react@18.3.0-next-e7c5af45c-20221023",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2", "react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@0.0.0-experimental-1d3fc9c9c-20221023", "react-dom-builtin": "npm:react-dom@18.3.0-next-e7c5af45c-20221023",
"react-server-dom-webpack": "0.0.0-experimental-1d3fc9c9c-20221023", "react-server-dom-webpack": "18.3.0-next-e7c5af45c-20221023",
"react-ssr-prepass": "1.0.8", "react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3", "react-virtualized": "9.22.3",
"relay-compiler": "13.0.2", "relay-compiler": "13.0.2",
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
import '../build/polyfills/polyfill-module' import '../build/polyfills/polyfill-module'
// @ts-ignore react-dom/client exists when using React 18 // @ts-ignore react-dom/client exists when using React 18
import ReactDOMClient from 'react-dom/client' import ReactDOMClient from 'react-dom/client'
// TODO-APP: change to React.use once it becomes stable import React, { use } from 'react'
import React, { experimental_use as use } from 'react'
import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-webpack/client' import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-webpack/client'
import measureWebVitals from './performance-relayer' import measureWebVitals from './performance-relayer'
......
'use client' 'use client'
import React, { import React, { useContext, useEffect, useRef, use } from 'react'
useContext,
useEffect,
useRef,
// TODO-APP: change to React.use once it becomes stable
experimental_use as use,
} from 'react'
import type { import type {
ChildProp, ChildProp,
//Segment //Segment
......
...@@ -6,7 +6,6 @@ import type { ...@@ -6,7 +6,6 @@ import type {
FlightSegmentPath, FlightSegmentPath,
Segment, Segment,
} from '../../server/app-render' } from '../../server/app-render'
// TODO-APP: change to React.use once it becomes stable
import { matchSegment } from './match-segments' import { matchSegment } from './match-segments'
import { fetchServerResponse } from './app-router' import { fetchServerResponse } from './app-router'
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -14,7 +14,7 @@ if (process.env.NODE_ENV !== "production") { ...@@ -14,7 +14,7 @@ if (process.env.NODE_ENV !== "production") {
(function() { (function() {
'use strict'; 'use strict';
var ReactVersion = '18.3.0-experimental-1d3fc9c9c-20221023'; var ReactVersion = '18.3.0-next-e7c5af45c-20221023';
var Internals = { var Internals = {
usingClientEntryPoint: false, usingClientEntryPoint: false,
...@@ -24,13 +24,6 @@ var Internals = { ...@@ -24,13 +24,6 @@ var Internals = {
} }
}; };
function createPortal() {
throw new Error('createPortal was called on the server. Portals are not currently' + ' supported on the server. Update your program to conditionally call' + ' createPortal on the client only.');
}
function flushSync() {
throw new Error('flushSync was called on the server. This is likely caused by a' + ' function being called during render or in module scope that was' + ' intended to be called from an effect or event handler. Update your' + ' to not call flushSync no the server.');
}
function preinit() { function preinit() {
var dispatcher = Internals.Dispatcher.current; var dispatcher = Internals.Dispatcher.current;
...@@ -52,6 +45,13 @@ function preload() { ...@@ -52,6 +45,13 @@ function preload() {
} }
function createPortal() {
throw new Error('createPortal was called on the server. Portals are not currently' + ' supported on the server. Update your program to conditionally call' + ' createPortal on the client only.');
}
function flushSync() {
throw new Error('flushSync was called on the server. This is likely caused by a' + ' function being called during render or in module scope that was' + ' intended to be called from an effect or event handler. Update your' + ' to not call flushSync no the server.');
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = createPortal; exports.createPortal = createPortal;
exports.flushSync = flushSync; exports.flushSync = flushSync;
......
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
'use strict';var b={usingClientEntryPoint:!1,Events:null,Dispatcher:{current:null}};function d(a){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)e+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=b; 'use strict';var b={usingClientEntryPoint:!1,Events:null,Dispatcher:{current:null}};function d(a){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)e+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=b;
exports.createPortal=function(){throw Error(d(448));};exports.flushSync=function(){throw Error(d(449));};exports.preinit=function(){var a=b.Dispatcher.current;a&&a.preinit.apply(this,arguments)};exports.preload=function(){var a=b.Dispatcher.current;a&&a.preload.apply(this,arguments)};exports.version="18.3.0-experimental-1d3fc9c9c-20221023"; exports.createPortal=function(){throw Error(d(448));};exports.flushSync=function(){throw Error(d(449));};exports.preinit=function(){var a=b.Dispatcher.current;a&&a.preinit.apply(this,arguments)};exports.preload=function(){var a=b.Dispatcher.current;a&&a.preload.apply(this,arguments)};exports.version="18.3.0-next-e7c5af45c-20221023";
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "react-dom", "name": "react-dom",
"version": "0.0.0-experimental-1d3fc9c9c-20221023", "version": "18.3.0-next-e7c5af45c-20221023",
"description": "React package for working with the DOM.", "description": "React package for working with the DOM.",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
"homepage": "https://reactjs.org/", "homepage": "https://reactjs.org/",
"dependencies": { "dependencies": {
"loose-envify": "^1.1.0", "loose-envify": "^1.1.0",
"scheduler": "0.0.0-experimental-1d3fc9c9c-20221023" "scheduler": "0.24.0-next-e7c5af45c-20221023"
}, },
"peerDependencies": { "peerDependencies": {
"react": "0.0.0-experimental-1d3fc9c9c-20221023" "react": "18.3.0-next-e7c5af45c-20221023"
}, },
"files": [ "files": [
"LICENSE", "LICENSE",
...@@ -32,12 +32,8 @@ ...@@ -32,12 +32,8 @@
"server.js", "server.js",
"server.browser.js", "server.browser.js",
"server.node.js", "server.node.js",
"static.js",
"static.browser.js",
"static.node.js",
"server-rendering-stub.js", "server-rendering-stub.js",
"test-utils.js", "test-utils.js",
"unstable_testing.js",
"unstable_server-external-runtime.js", "unstable_server-external-runtime.js",
"cjs/", "cjs/",
"umd/" "umd/"
...@@ -53,23 +49,13 @@ ...@@ -53,23 +49,13 @@
}, },
"./server.browser": "./server.browser.js", "./server.browser": "./server.browser.js",
"./server.node": "./server.node.js", "./server.node": "./server.node.js",
"./static": {
"deno": "./static.browser.js",
"worker": "./static.browser.js",
"browser": "./static.browser.js",
"default": "./static.node.js"
},
"./static.browser": "./static.browser.js",
"./static.node": "./static.node.js",
"./server-rendering-stub": "./server-rendering-stub.js", "./server-rendering-stub": "./server-rendering-stub.js",
"./profiling": "./profiling.js", "./profiling": "./profiling.js",
"./test-utils": "./test-utils.js", "./test-utils": "./test-utils.js",
"./unstable_testing": "./unstable_testing.js",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"browser": { "browser": {
"./server.js": "./server.browser.js", "./server.js": "./server.browser.js"
"./static.js": "./static.browser.js"
}, },
"browserify": { "browserify": {
"transform": [ "transform": [
......
...@@ -93,6 +93,7 @@ function printWarning(level, format, args) { ...@@ -93,6 +93,7 @@ function printWarning(level, format, args) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API. var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
...@@ -108,7 +109,7 @@ function isValidElementType(type) { ...@@ -108,7 +109,7 @@ function isValidElementType(type) {
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || type === REACT_CACHE_TYPE || enableTransitionTracing ) { if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true; return true;
} }
......
...@@ -93,6 +93,7 @@ function printWarning(level, format, args) { ...@@ -93,6 +93,7 @@ function printWarning(level, format, args) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API. var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
...@@ -108,7 +109,7 @@ function isValidElementType(type) { ...@@ -108,7 +109,7 @@ function isValidElementType(type) {
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || type === REACT_CACHE_TYPE || enableTransitionTracing ) { if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true; return true;
} }
......
...@@ -23,7 +23,7 @@ if ( ...@@ -23,7 +23,7 @@ if (
) { ) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
} }
var ReactVersion = '18.3.0-experimental-1d3fc9c9c-20221023'; var ReactVersion = '18.3.0-next-e7c5af45c-20221023';
// ATTENTION // ATTENTION
// When adding new symbols to this file, // When adding new symbols to this file,
...@@ -42,7 +42,6 @@ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); ...@@ -42,7 +42,6 @@ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = Symbol.for('react.memo'); var REACT_MEMO_TYPE = Symbol.for('react.memo');
var REACT_LAZY_TYPE = Symbol.for('react.lazy'); var REACT_LAZY_TYPE = Symbol.for('react.lazy');
var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode');
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
var REACT_CACHE_TYPE = Symbol.for('react.cache'); var REACT_CACHE_TYPE = Symbol.for('react.cache');
var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value'); var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
...@@ -149,6 +148,7 @@ function setExtraStackFrame(stack) { ...@@ -149,6 +148,7 @@ function setExtraStackFrame(stack) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API. var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
...@@ -1553,7 +1553,7 @@ function isValidElementType(type) { ...@@ -1553,7 +1553,7 @@ function isValidElementType(type) {
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || type === REACT_CACHE_TYPE || enableTransitionTracing ) { if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true; return true;
} }
...@@ -1729,36 +1729,6 @@ function resolveDispatcher() { ...@@ -1729,36 +1729,6 @@ function resolveDispatcher() {
return dispatcher; return dispatcher;
} }
function getCacheSignal() {
var dispatcher = ReactCurrentCache.current;
if (!dispatcher) {
// If we have no cache to associate with this call, then we don't know
// its lifetime. We abort early since that's safer than letting it live
// for ever. Unlike just caching which can be a functional noop outside
// of React, these should generally always be associated with some React
// render but we're not limiting quite as much as making it a Hook.
// It's safer than erroring early at runtime.
var controller = new AbortController();
var reason = new Error('This CacheSignal was requested outside React which means that it is ' + 'immediately aborted.'); // $FlowFixMe Flow doesn't yet know about this argument.
controller.abort(reason);
return controller.signal;
}
return dispatcher.getCacheSignal();
}
function getCacheForType(resourceType) {
var dispatcher = ReactCurrentCache.current;
if (!dispatcher) {
// If there is no dispatcher, then we treat this as not being cached.
return resourceType();
}
return dispatcher.getCacheForType(resourceType);
}
function useContext(Context) { function useContext(Context) {
var dispatcher = resolveDispatcher(); var dispatcher = resolveDispatcher();
...@@ -1846,16 +1816,6 @@ function use(usable) { ...@@ -1846,16 +1816,6 @@ function use(usable) {
return dispatcher.use(usable); return dispatcher.use(usable);
} }
function useMemoCache(size) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
return dispatcher.useMemoCache(size);
}
function useEvent(callback) {
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
return dispatcher.useEvent(callback);
}
// Helpers to patch console.logs to avoid logging during side-effect free // Helpers to patch console.logs to avoid logging during side-effect free
// replaying on render function. This currently only patches the object // replaying on render function. This currently only patches the object
...@@ -3036,30 +2996,22 @@ exports.Profiler = REACT_PROFILER_TYPE; ...@@ -3036,30 +2996,22 @@ exports.Profiler = REACT_PROFILER_TYPE;
exports.PureComponent = PureComponent; exports.PureComponent = PureComponent;
exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.StrictMode = REACT_STRICT_MODE_TYPE;
exports.Suspense = REACT_SUSPENSE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE;
exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
exports.cache = cache;
exports.cloneElement = cloneElement$1; exports.cloneElement = cloneElement$1;
exports.createContext = createContext; exports.createContext = createContext;
exports.createElement = createElement$1; exports.createElement = createElement$1;
exports.createFactory = createFactory; exports.createFactory = createFactory;
exports.createRef = createRef; exports.createRef = createRef;
exports.createServerContext = createServerContext; exports.createServerContext = createServerContext;
exports.experimental_cache = cache;
exports.experimental_use = use;
exports.experimental_useEvent = useEvent;
exports.forwardRef = forwardRef; exports.forwardRef = forwardRef;
exports.isValidElement = isValidElement; exports.isValidElement = isValidElement;
exports.lazy = lazy; exports.lazy = lazy;
exports.memo = memo; exports.memo = memo;
exports.startTransition = startTransition; exports.startTransition = startTransition;
exports.unstable_Cache = REACT_CACHE_TYPE;
exports.unstable_DebugTracingMode = REACT_DEBUG_TRACING_MODE_TYPE;
exports.unstable_Offscreen = REACT_OFFSCREEN_TYPE;
exports.unstable_act = act; exports.unstable_act = act;
exports.unstable_getCacheForType = getCacheForType;
exports.unstable_getCacheSignal = getCacheSignal;
exports.unstable_useCacheRefresh = useCacheRefresh; exports.unstable_useCacheRefresh = useCacheRefresh;
exports.unstable_useMemoCache = useMemoCache; exports.use = use;
exports.useCallback = useCallback; exports.useCallback = useCallback;
exports.useContext = useContext; exports.useContext = useContext;
exports.useDebugValue = useDebugValue; exports.useDebugValue = useDebugValue;
......
...@@ -101,6 +101,7 @@ function setExtraStackFrame(stack) { ...@@ -101,6 +101,7 @@ function setExtraStackFrame(stack) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API. var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
...@@ -295,7 +296,7 @@ function generateCacheKey(request) { ...@@ -295,7 +296,7 @@ function generateCacheKey(request) {
} }
} }
var ReactVersion = '18.3.0-experimental-1d3fc9c9c-20221023'; var ReactVersion = '18.3.0-next-e7c5af45c-20221023';
// ATTENTION // ATTENTION
// When adding new symbols to this file, // When adding new symbols to this file,
...@@ -314,7 +315,6 @@ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); ...@@ -314,7 +315,6 @@ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = Symbol.for('react.memo'); var REACT_MEMO_TYPE = Symbol.for('react.memo');
var REACT_LAZY_TYPE = Symbol.for('react.lazy'); var REACT_LAZY_TYPE = Symbol.for('react.lazy');
var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode');
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
var REACT_CACHE_TYPE = Symbol.for('react.cache'); var REACT_CACHE_TYPE = Symbol.for('react.cache');
var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value'); var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
...@@ -1543,7 +1543,7 @@ function isValidElementType(type) { ...@@ -1543,7 +1543,7 @@ function isValidElementType(type) {
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || type === REACT_CACHE_TYPE || enableTransitionTracing ) { if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true; return true;
} }
...@@ -1719,36 +1719,6 @@ function resolveDispatcher() { ...@@ -1719,36 +1719,6 @@ function resolveDispatcher() {
return dispatcher; return dispatcher;
} }
function getCacheSignal() {
var dispatcher = ReactCurrentCache.current;
if (!dispatcher) {
// If we have no cache to associate with this call, then we don't know
// its lifetime. We abort early since that's safer than letting it live
// for ever. Unlike just caching which can be a functional noop outside
// of React, these should generally always be associated with some React
// render but we're not limiting quite as much as making it a Hook.
// It's safer than erroring early at runtime.
var controller = new AbortController();
var reason = new Error('This CacheSignal was requested outside React which means that it is ' + 'immediately aborted.'); // $FlowFixMe Flow doesn't yet know about this argument.
controller.abort(reason);
return controller.signal;
}
return dispatcher.getCacheSignal();
}
function getCacheForType(resourceType) {
var dispatcher = ReactCurrentCache.current;
if (!dispatcher) {
// If there is no dispatcher, then we treat this as not being cached.
return resourceType();
}
return dispatcher.getCacheForType(resourceType);
}
function useContext(Context) { function useContext(Context) {
var dispatcher = resolveDispatcher(); var dispatcher = resolveDispatcher();
...@@ -2626,22 +2596,18 @@ exports.Fragment = REACT_FRAGMENT_TYPE; ...@@ -2626,22 +2596,18 @@ exports.Fragment = REACT_FRAGMENT_TYPE;
exports.Profiler = REACT_PROFILER_TYPE; exports.Profiler = REACT_PROFILER_TYPE;
exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.StrictMode = REACT_STRICT_MODE_TYPE;
exports.Suspense = REACT_SUSPENSE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE;
exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
exports.cache = cache;
exports.cloneElement = cloneElement$1; exports.cloneElement = cloneElement$1;
exports.createElement = createElement$1; exports.createElement = createElement$1;
exports.createRef = createRef; exports.createRef = createRef;
exports.createServerContext = createServerContext; exports.createServerContext = createServerContext;
exports.experimental_cache = cache;
exports.experimental_use = use;
exports.forwardRef = forwardRef; exports.forwardRef = forwardRef;
exports.isValidElement = isValidElement; exports.isValidElement = isValidElement;
exports.lazy = lazy; exports.lazy = lazy;
exports.memo = memo; exports.memo = memo;
exports.startTransition = startTransition; exports.startTransition = startTransition;
exports.unstable_DebugTracingMode = REACT_DEBUG_TRACING_MODE_TYPE; exports.use = use;
exports.unstable_getCacheForType = getCacheForType;
exports.unstable_getCacheSignal = getCacheSignal;
exports.useCallback = useCallback; exports.useCallback = useCallback;
exports.useContext = useContext; exports.useContext = useContext;
exports.useDebugValue = useDebugValue; exports.useDebugValue = useDebugValue;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"keywords": [ "keywords": [
"react" "react"
], ],
"version": "0.0.0-experimental-1d3fc9c9c-20221023", "version": "18.3.0-next-e7c5af45c-20221023",
"homepage": "https://reactjs.org/", "homepage": "https://reactjs.org/",
"bugs": "https://github.com/facebook/react/issues", "bugs": "https://github.com/facebook/react/issues",
"license": "MIT", "license": "MIT",
......
MIT License MIT License
Copyright (c) Meta Platforms, Inc. and affiliates. Copyright (c) Facebook, Inc. and its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
This diff is collapsed.
...@@ -4,11 +4,8 @@ import type { ServerRuntime } from '../types' ...@@ -4,11 +4,8 @@ import type { ServerRuntime } from '../types'
import type { FontLoaderManifest } from '../build/webpack/plugins/font-loader-manifest-plugin' import type { FontLoaderManifest } from '../build/webpack/plugins/font-loader-manifest-plugin'
// TODO-APP: investigate why require-hook doesn't work for app-render // TODO-APP: investigate why require-hook doesn't work for app-render
// TODO-APP: change to React.use once it becomes stable
import React, { import React, { use } from 'next/dist/compiled/react'
// @ts-ignore
experimental_use as use,
} from 'next/dist/compiled/react'
// this needs to be required lazily so that `next-server` can set // this needs to be required lazily so that `next-server` can set
// the env before we require // the env before we require
......
...@@ -41,7 +41,8 @@ declare module 'react' { ...@@ -41,7 +41,8 @@ declare module 'react' {
} }
// TODO-APP: check if this is the right type. // TODO-APP: check if this is the right type.
function experimental_use<T>(promise: Promise<T> | React.Context<T>): T function use<T>(promise: Promise<T> | React.Context<T>): T
function cache<T extends Function>(fn: T): T
} }
export type Redirect = export type Redirect =
......
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"next": "latest", "next": "latest",
"react": "0.0.0-experimental-9cdf8a99e-20221018", "react": "latest",
"react-dom": "0.0.0-experimental-9cdf8a99e-20221018" "react-dom": "latest"
} }
} }
...@@ -16,8 +16,8 @@ describe('ReactRefresh app', () => { ...@@ -16,8 +16,8 @@ describe('ReactRefresh app', () => {
next = await createNext({ next = await createNext({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: { dependencies: {
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
skipStart: true, skipStart: true,
}) })
......
...@@ -16,8 +16,8 @@ describe('ReactRefreshLogBox app', () => { ...@@ -16,8 +16,8 @@ describe('ReactRefreshLogBox app', () => {
next = await createNext({ next = await createNext({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: { dependencies: {
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
skipStart: true, skipStart: true,
}) })
......
...@@ -20,8 +20,8 @@ describe.skip('ReactRefreshLogBox app', () => { ...@@ -20,8 +20,8 @@ describe.skip('ReactRefreshLogBox app', () => {
skipStart: true, skipStart: true,
dependencies: { dependencies: {
sass: 'latest', sass: 'latest',
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
}) })
}) })
......
...@@ -17,8 +17,8 @@ describe('ReactRefreshLogBox app', () => { ...@@ -17,8 +17,8 @@ describe('ReactRefreshLogBox app', () => {
next = await createNext({ next = await createNext({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: { dependencies: {
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
skipStart: true, skipStart: true,
}) })
...@@ -34,7 +34,7 @@ describe('ReactRefreshLogBox app', () => { ...@@ -34,7 +34,7 @@ describe('ReactRefreshLogBox app', () => {
export default function Page() { export default function Page() {
return ( return (
<> <>
<p>index page</p> <p>index page</p>
<a onClick={() => { <a onClick={() => {
...@@ -984,7 +984,7 @@ describe('ReactRefreshLogBox app', () => { ...@@ -984,7 +984,7 @@ describe('ReactRefreshLogBox app', () => {
'index.js', 'index.js',
` `
class Hello {} class Hello {}
export default () => { export default () => {
throw Hello throw Hello
return ( return (
......
...@@ -17,8 +17,8 @@ describe.skip('ReactRefreshLogBox app', () => { ...@@ -17,8 +17,8 @@ describe.skip('ReactRefreshLogBox app', () => {
next = await createNext({ next = await createNext({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: { dependencies: {
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
skipStart: true, skipStart: true,
}) })
......
...@@ -15,8 +15,8 @@ describe('ReactRefreshModule app', () => { ...@@ -15,8 +15,8 @@ describe('ReactRefreshModule app', () => {
next = await createNext({ next = await createNext({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: { dependencies: {
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
skipStart: true, skipStart: true,
}) })
......
...@@ -20,8 +20,8 @@ describe('ReactRefreshRegression app', () => { ...@@ -20,8 +20,8 @@ describe('ReactRefreshRegression app', () => {
'styled-components': '5.1.0', 'styled-components': '5.1.0',
'@next/mdx': 'canary', '@next/mdx': 'canary',
'@mdx-js/loader': '0.18.0', '@mdx-js/loader': '0.18.0',
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
}) })
}) })
......
...@@ -11,8 +11,8 @@ describe('ReactRefreshRequire app', () => { ...@@ -11,8 +11,8 @@ describe('ReactRefreshRequire app', () => {
next = await createNext({ next = await createNext({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: { dependencies: {
react: '0.0.0-experimental-9cdf8a99e-20221018', react: 'latest',
'react-dom': '0.0.0-experimental-9cdf8a99e-20221018', 'react-dom': 'latest',
}, },
skipStart: true, skipStart: true,
}) })
......
import { experimental_use as use } from 'react' import { use } from 'react'
async function getData() { async function getData() {
await new Promise((resolve) => setTimeout(resolve, 400)) await new Promise((resolve) => setTimeout(resolve, 400))
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment