|
12 | 12 |
|
13 | 13 | if (process.env.NODE_ENV !== "production") {
|
14 | 14 | (function() {
|
15 |
| - |
16 |
| - 'use strict'; |
17 |
| - |
18 |
| -/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ |
| 15 | +'use strict'; |
19 | 16 | if (
|
20 | 17 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
21 | 18 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
22 | 19 | 'function'
|
23 | 20 | ) {
|
24 | 21 | __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
25 | 22 | }
|
26 |
| - var React = require("next/dist/compiled/react"); |
| 23 | +var React = require("next/dist/compiled/react"); |
27 | 24 | var Scheduler = require("next/dist/compiled/scheduler");
|
28 | 25 | var ReactDOM = require('react-dom');
|
29 | 26 |
|
@@ -241,6 +238,7 @@ var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode');
|
241 | 238 | var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
242 | 239 | var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden');
|
243 | 240 | var REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker');
|
| 241 | +var REACT_MEMO_CACHE_SENTINEL = Symbol.for('react.memo_cache_sentinel'); |
244 | 242 | var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
245 | 243 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
246 | 244 | function getIteratorFn(maybeIterable) {
|
@@ -8782,6 +8780,11 @@ function extractEvents$1(dispatchQueue, domEventName, maybeTargetInst, nativeEve
|
8782 | 8780 | var temp = submitter.ownerDocument.createElement('input');
|
8783 | 8781 | temp.name = submitter.name;
|
8784 | 8782 | temp.value = submitter.value;
|
| 8783 | + |
| 8784 | + if (form.id) { |
| 8785 | + temp.setAttribute('form', form.id); |
| 8786 | + } |
| 8787 | + |
8785 | 8788 | submitter.parentNode.insertBefore(temp, submitter);
|
8786 | 8789 | formData = new FormData(form);
|
8787 | 8790 | temp.parentNode.removeChild(temp);
|
@@ -17386,7 +17389,8 @@ var createFunctionComponentUpdateQueue;
|
17386 | 17389 | return {
|
17387 | 17390 | lastEffect: null,
|
17388 | 17391 | events: null,
|
17389 |
| - stores: null |
| 17392 | + stores: null, |
| 17393 | + memoCache: null |
17390 | 17394 | };
|
17391 | 17395 | };
|
17392 | 17396 | }
|
@@ -17432,6 +17436,93 @@ function use(usable) {
|
17432 | 17436 | throw new Error('An unsupported type was passed to use(): ' + String(usable));
|
17433 | 17437 | }
|
17434 | 17438 |
|
| 17439 | +function useMemoCache(size) { |
| 17440 | + var memoCache = null; // Fast-path, load memo cache from wip fiber if already prepared |
| 17441 | + |
| 17442 | + var updateQueue = currentlyRenderingFiber$1.updateQueue; |
| 17443 | + |
| 17444 | + if (updateQueue !== null) { |
| 17445 | + memoCache = updateQueue.memoCache; |
| 17446 | + } // Otherwise clone from the current fiber |
| 17447 | + |
| 17448 | + |
| 17449 | + if (memoCache == null) { |
| 17450 | + var current = currentlyRenderingFiber$1.alternate; |
| 17451 | + |
| 17452 | + if (current !== null) { |
| 17453 | + var currentUpdateQueue = current.updateQueue; |
| 17454 | + |
| 17455 | + if (currentUpdateQueue !== null) { |
| 17456 | + var currentMemoCache = currentUpdateQueue.memoCache; |
| 17457 | + |
| 17458 | + if (currentMemoCache != null) { |
| 17459 | + memoCache = { |
| 17460 | + // When enableNoCloningMemoCache is enabled, instead of treating the |
| 17461 | + // cache as copy-on-write, like we do with fibers, we share the same |
| 17462 | + // cache instance across all render attempts, even if the component |
| 17463 | + // is interrupted before it commits. |
| 17464 | + // |
| 17465 | + // If an update is interrupted, either because it suspended or |
| 17466 | + // because of another update, we can reuse the memoized computations |
| 17467 | + // from the previous attempt. We can do this because the React |
| 17468 | + // Compiler performs atomic writes to the memo cache, i.e. it will |
| 17469 | + // not record the inputs to a memoization without also recording its |
| 17470 | + // output. |
| 17471 | + // |
| 17472 | + // This gives us a form of "resuming" within components and hooks. |
| 17473 | + // |
| 17474 | + // This only works when updating a component that already mounted. |
| 17475 | + // It has no impact during initial render, because the memo cache is |
| 17476 | + // stored on the fiber, and since we have not implemented resuming |
| 17477 | + // for fibers, it's always a fresh memo cache, anyway. |
| 17478 | + // |
| 17479 | + // However, this alone is pretty useful — it happens whenever you |
| 17480 | + // update the UI with fresh data after a mutation/action, which is |
| 17481 | + // extremely common in a Suspense-driven (e.g. RSC or Relay) app. |
| 17482 | + data: // Clone the memo cache before each render (copy-on-write) |
| 17483 | + currentMemoCache.data.map(function (array) { |
| 17484 | + return array.slice(); |
| 17485 | + }), |
| 17486 | + index: 0 |
| 17487 | + }; |
| 17488 | + } |
| 17489 | + } |
| 17490 | + } |
| 17491 | + } // Finally fall back to allocating a fresh instance of the cache |
| 17492 | + |
| 17493 | + |
| 17494 | + if (memoCache == null) { |
| 17495 | + memoCache = { |
| 17496 | + data: [], |
| 17497 | + index: 0 |
| 17498 | + }; |
| 17499 | + } |
| 17500 | + |
| 17501 | + if (updateQueue === null) { |
| 17502 | + updateQueue = createFunctionComponentUpdateQueue(); |
| 17503 | + currentlyRenderingFiber$1.updateQueue = updateQueue; |
| 17504 | + } |
| 17505 | + |
| 17506 | + updateQueue.memoCache = memoCache; |
| 17507 | + var data = memoCache.data[memoCache.index]; |
| 17508 | + |
| 17509 | + if (data === undefined) { |
| 17510 | + data = memoCache.data[memoCache.index] = new Array(size); |
| 17511 | + |
| 17512 | + for (var i = 0; i < size; i++) { |
| 17513 | + data[i] = REACT_MEMO_CACHE_SENTINEL; |
| 17514 | + } |
| 17515 | + } else if (data.length !== size) { |
| 17516 | + // TODO: consider warning or throwing here |
| 17517 | + { |
| 17518 | + error('Expected a constant size argument for each invocation of useMemoCache. ' + 'The previous cache was allocated with size %s but size %s was requested.', data.length, size); |
| 17519 | + } |
| 17520 | + } |
| 17521 | + |
| 17522 | + memoCache.index++; |
| 17523 | + return data; |
| 17524 | +} |
| 17525 | + |
17435 | 17526 | function basicStateReducer(state, action) {
|
17436 | 17527 | // $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
|
17437 | 17528 | return typeof action === 'function' ? action(state) : action;
|
@@ -19230,6 +19321,10 @@ var ContextOnlyDispatcher = {
|
19230 | 19321 | ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError;
|
19231 | 19322 | }
|
19232 | 19323 |
|
| 19324 | +{ |
| 19325 | + ContextOnlyDispatcher.useMemoCache = throwInvalidHookError; |
| 19326 | +} |
| 19327 | + |
19233 | 19328 | {
|
19234 | 19329 | ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError;
|
19235 | 19330 | ContextOnlyDispatcher.useFormState = throwInvalidHookError;
|
@@ -19374,6 +19469,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
19374 | 19469 | };
|
19375 | 19470 | }
|
19376 | 19471 |
|
| 19472 | + { |
| 19473 | + HooksDispatcherOnMountInDEV.useMemoCache = useMemoCache; |
| 19474 | + } |
| 19475 | + |
19377 | 19476 | {
|
19378 | 19477 | HooksDispatcherOnMountInDEV.useHostTransitionStatus = useHostTransitionStatus;
|
19379 | 19478 |
|
@@ -19509,6 +19608,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
19509 | 19608 | };
|
19510 | 19609 | }
|
19511 | 19610 |
|
| 19611 | + { |
| 19612 | + HooksDispatcherOnMountWithHookTypesInDEV.useMemoCache = useMemoCache; |
| 19613 | + } |
| 19614 | + |
19512 | 19615 | {
|
19513 | 19616 | HooksDispatcherOnMountWithHookTypesInDEV.useHostTransitionStatus = useHostTransitionStatus;
|
19514 | 19617 |
|
@@ -19645,6 +19748,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
19645 | 19748 | };
|
19646 | 19749 | }
|
19647 | 19750 |
|
| 19751 | + { |
| 19752 | + HooksDispatcherOnUpdateInDEV.useMemoCache = useMemoCache; |
| 19753 | + } |
| 19754 | + |
19648 | 19755 | {
|
19649 | 19756 | HooksDispatcherOnUpdateInDEV.useHostTransitionStatus = useHostTransitionStatus;
|
19650 | 19757 |
|
@@ -19781,6 +19888,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
19781 | 19888 | };
|
19782 | 19889 | }
|
19783 | 19890 |
|
| 19891 | + { |
| 19892 | + HooksDispatcherOnRerenderInDEV.useMemoCache = useMemoCache; |
| 19893 | + } |
| 19894 | + |
19784 | 19895 | {
|
19785 | 19896 | HooksDispatcherOnRerenderInDEV.useHostTransitionStatus = useHostTransitionStatus;
|
19786 | 19897 |
|
@@ -19936,6 +20047,13 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
19936 | 20047 | };
|
19937 | 20048 | }
|
19938 | 20049 |
|
| 20050 | + { |
| 20051 | + InvalidNestedHooksDispatcherOnMountInDEV.useMemoCache = function (size) { |
| 20052 | + warnInvalidHookAccess(); |
| 20053 | + return useMemoCache(size); |
| 20054 | + }; |
| 20055 | + } |
| 20056 | + |
19939 | 20057 | {
|
19940 | 20058 | InvalidNestedHooksDispatcherOnMountInDEV.useHostTransitionStatus = useHostTransitionStatus;
|
19941 | 20059 |
|
@@ -20093,6 +20211,13 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
20093 | 20211 | };
|
20094 | 20212 | }
|
20095 | 20213 |
|
| 20214 | + { |
| 20215 | + InvalidNestedHooksDispatcherOnUpdateInDEV.useMemoCache = function (size) { |
| 20216 | + warnInvalidHookAccess(); |
| 20217 | + return useMemoCache(size); |
| 20218 | + }; |
| 20219 | + } |
| 20220 | + |
20096 | 20221 | {
|
20097 | 20222 | InvalidNestedHooksDispatcherOnUpdateInDEV.useHostTransitionStatus = useHostTransitionStatus;
|
20098 | 20223 |
|
@@ -20250,6 +20375,13 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
20250 | 20375 | };
|
20251 | 20376 | }
|
20252 | 20377 |
|
| 20378 | + { |
| 20379 | + InvalidNestedHooksDispatcherOnRerenderInDEV.useMemoCache = function (size) { |
| 20380 | + warnInvalidHookAccess(); |
| 20381 | + return useMemoCache(size); |
| 20382 | + }; |
| 20383 | + } |
| 20384 | + |
20253 | 20385 | {
|
20254 | 20386 | InvalidNestedHooksDispatcherOnRerenderInDEV.useHostTransitionStatus = useHostTransitionStatus;
|
20255 | 20387 |
|
@@ -35828,7 +35960,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
|
35828 | 35960 | return root;
|
35829 | 35961 | }
|
35830 | 35962 |
|
35831 |
| -var ReactVersion = '19.0.0-beta-4508873393-20240430'; |
| 35963 | +var ReactVersion = '19.0.0-beta-04b058868c-20240508'; |
35832 | 35964 |
|
35833 | 35965 | // Might add PROFILE later.
|
35834 | 35966 |
|
@@ -37328,14 +37460,13 @@ var foundDevTools = injectIntoDevTools({
|
37328 | 37460 | exports.createRoot = createRoot;
|
37329 | 37461 | exports.hydrateRoot = hydrateRoot;
|
37330 | 37462 | exports.version = ReactVersion;
|
37331 |
| - /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ |
37332 | 37463 | if (
|
37333 | 37464 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
37334 | 37465 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
37335 | 37466 | 'function'
|
37336 | 37467 | ) {
|
37337 | 37468 | __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
37338 | 37469 | }
|
37339 |
| - |
| 37470 | + |
37340 | 37471 | })();
|
37341 | 37472 | }
|
0 commit comments