diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 2f4ff0fe4c..3cc301302c 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -dc6a7e01e1d2fa5eb4974f9bb66e9e8fb40f6ef8 +41950d14a538aa7411b00b28bcd94ae95a45976e diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 685c2c2a13..753f418191 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -66,7 +66,7 @@ if (__DEV__) { return self; } - var ReactVersion = "19.0.0-www-classic-877fd74a"; + var ReactVersion = "19.0.0-www-classic-5df29fbc"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -586,6 +586,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -655,7 +656,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -9384,13 +9386,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the @@ -21259,7 +21277,7 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -23591,6 +23609,19 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index ebcbb119df..2e604c3730 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -66,7 +66,7 @@ if (__DEV__) { return self; } - var ReactVersion = "19.0.0-www-modern-bf3441a6"; + var ReactVersion = "19.0.0-www-modern-2b9608d3"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -588,6 +588,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var HostEffectMask = /* */ @@ -655,7 +656,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -9135,13 +9137,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the @@ -20632,7 +20650,7 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -22958,6 +22976,19 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index fd9c28067f..8c16970dbd 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -2622,10 +2622,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -7855,7 +7861,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -10599,7 +10605,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "19.0.0-www-classic-f1bbc587", + version: "19.0.0-www-classic-52a8955f", rendererPackageName: "react-art" }; var internals$jscomp$inline_1322 = { @@ -10630,7 +10636,7 @@ var internals$jscomp$inline_1322 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-f1bbc587" + reconcilerVersion: "19.0.0-www-classic-52a8955f" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1323 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index 9c10143b26..36abae3d2a 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -2420,10 +2420,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -7410,7 +7416,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -10078,7 +10084,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "19.0.0-www-modern-4749dbb1", + version: "19.0.0-www-modern-e590ea90", rendererPackageName: "react-art" }; var internals$jscomp$inline_1307 = { @@ -10109,7 +10115,7 @@ var internals$jscomp$inline_1307 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-4749dbb1" + reconcilerVersion: "19.0.0-www-modern-e590ea90" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1308 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index e66ecba5a9..ec56a90f89 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -551,6 +551,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -620,7 +621,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -13938,13 +13940,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function checkDidRenderIdHook() { // This should be called immediately after every renderWithHooks call. @@ -15844,7 +15862,29 @@ if (__DEV__) { baseQueue: null, queue: newQueue, next: null - }; // Add the state hook to both fiber alternates. The idea is that the fiber + }; // We use another state hook to track whether the form needs to be reset. + // The state is an empty object. To trigger a reset, we update the state + // to a new object. Then during rendering, we detect that the state has + // changed and schedule a commit effect. + + var initialResetState = {}; + var newResetStateQueue = { + pending: null, + lanes: NoLanes, + // We're going to cheat and intentionally not create a bound dispatch + // method, because we can call it directly in startTransition. + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }; + var resetStateHook = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: newResetStateQueue, + next: null + }; + stateHook.next = resetStateHook; // Add the hook list to both fiber alternates. The idea is that the fiber // had this hook all along. formFiber.memoizedState = stateHook; @@ -15866,11 +15906,40 @@ if (__DEV__) { NotPendingTransition, // TODO: We can avoid this extra wrapper, somehow. Figure out layering // once more of this function is implemented. function () { + // Automatically reset the form when the action completes. + requestFormReset(formFiber); return callback(formData); } ); } + function requestFormReset(formFiber) { + var transition = requestCurrentTransition(); + + { + if (transition === null) { + // An optimistic update occurred, but startTransition is not on the stack. + // The form reset will be scheduled at default (sync) priority, which + // is probably not what the user intended. Most likely because the + // requestFormReset call happened after an `await`. + // TODO: Theoretically, requestFormReset is still useful even for + // non-transition updates because it allows you to update defaultValue + // synchronously and then wait to reset until after the update commits. + // I've chosen to warn anyway because it's more likely the `await` mistake + // described above. But arguably we shouldn't. + error( + "requestFormReset was called outside a transition or action. To " + + "fix, move to an action, or wrap with startTransition." + ); + } + } + + var newResetState = {}; + var resetStateHook = formFiber.memoizedState.next; + var resetStateQueue = resetStateHook.queue; + dispatchSetState(formFiber, resetStateQueue, newResetState); + } + function mountTransition() { var stateHook = mountStateImpl(false); // The `start` method never changes. @@ -26557,7 +26626,9 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. + + var needsFormReset = false; var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -29153,6 +29224,21 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + needsFormReset = true; + + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -29223,6 +29309,20 @@ if (__DEV__) { } } + if (needsFormReset) { + // A form component requested to be reset during this commit. We do this + // after all mutations in the rest of the tree so that `defaultValue` + // will already be updated. This way you can update `defaultValue` using + // data sent by the server as a result of the form submission. + // + // Theoretically we could check finishedWork.subtreeFlags & FormReset, + // but the FormReset bit is overloaded with other flags used by other + // fiber types. So this extra variable lets us skip traversing the tree + // except when a form was actually submitted. + needsFormReset = false; + recursivelyResetForms(finishedWork); + } + return; } @@ -29450,6 +29550,26 @@ if (__DEV__) { } } + function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & FormReset) { + var child = parentFiber.child; + + while (child !== null) { + resetFormOnFiber(child); + child = child.sibling; + } + } + } + + function resetFormOnFiber(fiber) { + recursivelyResetForms(fiber); + + if (fiber.tag === HostComponent && fiber.flags & FormReset) { + var formInstance = fiber.stateNode; + resetFormInstance(formInstance); + } + } + function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; @@ -36095,7 +36215,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-classic-204bdccf"; + var ReactVersion = "19.0.0-www-classic-a7365ec3"; function createPortal$1( children, @@ -47111,6 +47231,9 @@ if (__DEV__) { } var NotPendingTransition = NotPending; + function resetFormInstance(form) { + form.reset(); + } var randomKey = Math.random().toString(36).slice(2); var internalInstanceKey = "__reactFiber$" + randomKey; diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 8c5f2f4841..44da9fefde 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -195,6 +195,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var HostEffectMask = /* */ @@ -262,7 +263,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -21490,13 +21492,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function checkDidRenderIdHook() { // This should be called immediately after every renderWithHooks call. @@ -23396,7 +23414,29 @@ if (__DEV__) { baseQueue: null, queue: newQueue, next: null - }; // Add the state hook to both fiber alternates. The idea is that the fiber + }; // We use another state hook to track whether the form needs to be reset. + // The state is an empty object. To trigger a reset, we update the state + // to a new object. Then during rendering, we detect that the state has + // changed and schedule a commit effect. + + var initialResetState = {}; + var newResetStateQueue = { + pending: null, + lanes: NoLanes, + // We're going to cheat and intentionally not create a bound dispatch + // method, because we can call it directly in startTransition. + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }; + var resetStateHook = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: newResetStateQueue, + next: null + }; + stateHook.next = resetStateHook; // Add the hook list to both fiber alternates. The idea is that the fiber // had this hook all along. formFiber.memoizedState = stateHook; @@ -23418,11 +23458,40 @@ if (__DEV__) { NotPendingTransition, // TODO: We can avoid this extra wrapper, somehow. Figure out layering // once more of this function is implemented. function () { + // Automatically reset the form when the action completes. + requestFormReset(formFiber); return callback(formData); } ); } + function requestFormReset(formFiber) { + var transition = requestCurrentTransition(); + + { + if (transition === null) { + // An optimistic update occurred, but startTransition is not on the stack. + // The form reset will be scheduled at default (sync) priority, which + // is probably not what the user intended. Most likely because the + // requestFormReset call happened after an `await`. + // TODO: Theoretically, requestFormReset is still useful even for + // non-transition updates because it allows you to update defaultValue + // synchronously and then wait to reset until after the update commits. + // I've chosen to warn anyway because it's more likely the `await` mistake + // described above. But arguably we shouldn't. + error( + "requestFormReset was called outside a transition or action. To " + + "fix, move to an action, or wrap with startTransition." + ); + } + } + + var newResetState = {}; + var resetStateHook = formFiber.memoizedState.next; + var resetStateQueue = resetStateHook.queue; + dispatchSetState(formFiber, resetStateQueue, newResetState); + } + function mountTransition() { var stateHook = mountStateImpl(false); // The `start` method never changes. @@ -32078,7 +32147,9 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. + + var needsFormReset = false; var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -34668,6 +34739,21 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + needsFormReset = true; + + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -34738,6 +34824,20 @@ if (__DEV__) { } } + if (needsFormReset) { + // A form component requested to be reset during this commit. We do this + // after all mutations in the rest of the tree so that `defaultValue` + // will already be updated. This way you can update `defaultValue` using + // data sent by the server as a result of the form submission. + // + // Theoretically we could check finishedWork.subtreeFlags & FormReset, + // but the FormReset bit is overloaded with other flags used by other + // fiber types. So this extra variable lets us skip traversing the tree + // except when a form was actually submitted. + needsFormReset = false; + recursivelyResetForms(finishedWork); + } + return; } @@ -34963,6 +35063,26 @@ if (__DEV__) { } } + function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & FormReset) { + var child = parentFiber.child; + + while (child !== null) { + resetFormOnFiber(child); + child = child.sibling; + } + } + } + + function resetFormOnFiber(fiber) { + recursivelyResetForms(fiber); + + if (fiber.tag === HostComponent && fiber.flags & FormReset) { + var formInstance = fiber.stateNode; + resetFormInstance(formInstance); + } + } + function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; @@ -45432,6 +45552,9 @@ if (__DEV__) { } var NotPendingTransition = NotPending; + function resetFormInstance(form) { + form.reset(); + } function FiberRootNode( containerInfo, // $FlowFixMe[missing-local-annot] @@ -45586,7 +45709,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-modern-c1fa481b"; + var ReactVersion = "19.0.0-www-modern-b8d3ecdc"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index cfcdac4343..69947a91cf 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -3325,10 +3325,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function checkDidRenderIdHook() { var didRenderIdHook = 0 !== localIdCounter; @@ -4128,9 +4134,23 @@ function startHostTransition(formFiber, pendingState, callback, formData) { queue: newQueue, next: null }; + var initialResetState = {}; + newQueue.next = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }, + next: null + }; formFiber.memoizedState = newQueue; - var alternate = formFiber.alternate; - null !== alternate && (alternate.memoizedState = newQueue); + initialResetState = formFiber.alternate; + null !== initialResetState && (initialResetState.memoizedState = newQueue); } else queue = formFiber.memoizedState.queue; startTransition( formFiber, @@ -4138,6 +4158,8 @@ function startHostTransition(formFiber, pendingState, callback, formData) { pendingState, sharedNotPendingObject, function () { + requestCurrentTransition(); + dispatchSetState(formFiber, formFiber.memoizedState.next.queue, {}); return callback(formData); } ); @@ -8345,6 +8367,7 @@ function unwindInterruptedWork(current, interruptedWork) { } var offscreenSubtreeIsHidden = !1, offscreenSubtreeWasHidden = !1, + needsFormReset = !1, PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, nextEffect = null; function callComponentWillUnmountWithTimer(current, instance) { @@ -9359,7 +9382,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -9399,11 +9422,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), null !== finishedWork && - ((current = finishedWork.callbacks), - null !== current && - ((flags = finishedWork.shared.hiddenCallbacks), + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), (finishedWork.shared.hiddenCallbacks = - null === flags ? current : flags.concat(current))))); + null === current ? flags : current.concat(flags))))); break; case 26: var hoistableRoot = currentHoistableRoot; @@ -9421,10 +9444,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === flags) if (null === finishedWork.stateNode) { a: { - current = finishedWork.type; - flags = finishedWork.memoizedProps; + flags = finishedWork.type; + current = finishedWork.memoizedProps; root = hoistableRoot.ownerDocument || hoistableRoot; - b: switch (current) { + b: switch (flags) { case "title": hoistableRoot = root.getElementsByTagName("title")[0]; if ( @@ -9435,42 +9458,42 @@ function commitMutationEffectsOnFiber(finishedWork, root) { hoistableRoot.namespaceURI || hoistableRoot.hasAttribute("itemprop") ) - (hoistableRoot = root.createElement(current)), + (hoistableRoot = root.createElement(flags)), root.head.insertBefore( hoistableRoot, root.querySelector("head > title") ); - setInitialProperties(hoistableRoot, current, flags); + setInitialProperties(hoistableRoot, flags, current); hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; break a; case "link": var maybeNodes = getHydratableHoistableCache( "link", "href", root - ).get(current + (flags.href || "")); + ).get(flags + (current.href || "")); if (maybeNodes) for (var i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("href") === - (null == flags.href ? null : flags.href) && + (null == current.href ? null : current.href) && hoistableRoot.getAttribute("rel") === - (null == flags.rel ? null : flags.rel) && + (null == current.rel ? null : current.rel) && hoistableRoot.getAttribute("title") === - (null == flags.title ? null : flags.title) && + (null == current.title ? null : current.title) && hoistableRoot.getAttribute("crossorigin") === - (null == flags.crossOrigin + (null == current.crossOrigin ? null - : flags.crossOrigin)) + : current.crossOrigin)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; case "meta": @@ -9479,43 +9502,45 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "meta", "content", root - ).get(current + (flags.content || ""))) + ).get(flags + (current.content || ""))) ) for (i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("content") === - (null == flags.content + (null == current.content ? null - : "" + flags.content) && + : "" + current.content) && hoistableRoot.getAttribute("name") === - (null == flags.name ? null : flags.name) && + (null == current.name ? null : current.name) && hoistableRoot.getAttribute("property") === - (null == flags.property + (null == current.property ? null - : flags.property) && + : current.property) && hoistableRoot.getAttribute("http-equiv") === - (null == flags.httpEquiv + (null == current.httpEquiv ? null - : flags.httpEquiv) && + : current.httpEquiv) && hoistableRoot.getAttribute("charset") === - (null == flags.charSet ? null : flags.charSet)) + (null == current.charSet + ? null + : current.charSet)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; default: - throw Error(formatProdErrorMessage(468, current)); + throw Error(formatProdErrorMessage(468, flags)); } hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; } - finishedWork.stateNode = current; + finishedWork.stateNode = flags; } else mountHoistable( hoistableRoot, @@ -9603,18 +9628,19 @@ function commitMutationEffectsOnFiber(finishedWork, root) { captureCommitPhaseError(finishedWork, finishedWork.return, error$167); } } - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - root = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : root; - hoistableRoot = finishedWork.type; + if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { + hoistableRoot = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : hoistableRoot; + maybeNodes = finishedWork.type; finishedWork.updateQueue = null; try { - updateProperties(flags, hoistableRoot, current, root), - (flags[internalPropsKey] = root); + updateProperties(root, maybeNodes, current, hoistableRoot), + (root[internalPropsKey] = hoistableRoot); } catch (error$170) { captureCommitPhaseError(finishedWork, finishedWork.return, error$170); } } + flags & 1024 && (needsFormReset = !0); break; case 6: recursivelyTraverseMutationEffects(root, finishedWork); @@ -9622,10 +9648,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4) { if (null === finishedWork.stateNode) throw Error(formatProdErrorMessage(162)); - current = finishedWork.stateNode; - flags = finishedWork.memoizedProps; + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; try { - current.nodeValue = flags; + flags.nodeValue = current; } catch (error$171) { captureCommitPhaseError(finishedWork, finishedWork.return, error$171); } @@ -9644,15 +9670,17 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$172) { captureCommitPhaseError(finishedWork, finishedWork.return, error$172); } + needsFormReset && + ((needsFormReset = !1), recursivelyResetForms(finishedWork)); break; case 4: - current = currentHoistableRoot; + flags = currentHoistableRoot; currentHoistableRoot = getHoistableRoot( finishedWork.stateNode.containerInfo ); recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); - currentHoistableRoot = current; + currentHoistableRoot = flags; break; case 13: recursivelyTraverseMutationEffects(root, finishedWork); @@ -9675,10 +9703,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$174) { captureCommitPhaseError(finishedWork, finishedWork.return, error$174); } - current = finishedWork.updateQueue; - null !== current && + flags = finishedWork.updateQueue; + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current)); + attachSuspenseRetryListeners(finishedWork, flags)); } break; case 22: @@ -9779,21 +9807,21 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = root.sibling; } flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && - ((flags = current.retryQueue), - null !== flags && - ((current.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, flags)))); + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && + ((flags = finishedWork.updateQueue), + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current))); + attachSuspenseRetryListeners(finishedWork, flags))); break; case 21: recursivelyTraverseMutationEffects(root, finishedWork); @@ -9858,6 +9886,15 @@ function commitReconciliationEffects(finishedWork) { } flags & 4096 && (finishedWork.flags &= -4097); } +function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & 1024) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var fiber = parentFiber; + recursivelyResetForms(fiber); + 5 === fiber.tag && fiber.flags & 1024 && fiber.stateNode.reset(); + parentFiber = parentFiber.sibling; + } +} function recursivelyTraverseLayoutEffects(root, parentFiber) { if (parentFiber.subtreeFlags & 8772) for (parentFiber = parentFiber.child; null !== parentFiber; ) @@ -13018,14 +13055,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$352; if (canUseDOM) { - var isSupported$jscomp$inline_1495 = "oninput" in document; - if (!isSupported$jscomp$inline_1495) { - var element$jscomp$inline_1496 = document.createElement("div"); - element$jscomp$inline_1496.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1495 = - "function" === typeof element$jscomp$inline_1496.oninput; + var isSupported$jscomp$inline_1503 = "oninput" in document; + if (!isSupported$jscomp$inline_1503) { + var element$jscomp$inline_1504 = document.createElement("div"); + element$jscomp$inline_1504.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1503 = + "function" === typeof element$jscomp$inline_1504.oninput; } - JSCompiler_inline_result$jscomp$352 = isSupported$jscomp$inline_1495; + JSCompiler_inline_result$jscomp$352 = isSupported$jscomp$inline_1503; } else JSCompiler_inline_result$jscomp$352 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$352 && @@ -13406,20 +13443,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1536 = 0; - i$jscomp$inline_1536 < simpleEventPluginEvents.length; - i$jscomp$inline_1536++ + var i$jscomp$inline_1544 = 0; + i$jscomp$inline_1544 < simpleEventPluginEvents.length; + i$jscomp$inline_1544++ ) { - var eventName$jscomp$inline_1537 = - simpleEventPluginEvents[i$jscomp$inline_1536], - domEventName$jscomp$inline_1538 = - eventName$jscomp$inline_1537.toLowerCase(), - capitalizedEvent$jscomp$inline_1539 = - eventName$jscomp$inline_1537[0].toUpperCase() + - eventName$jscomp$inline_1537.slice(1); + var eventName$jscomp$inline_1545 = + simpleEventPluginEvents[i$jscomp$inline_1544], + domEventName$jscomp$inline_1546 = + eventName$jscomp$inline_1545.toLowerCase(), + capitalizedEvent$jscomp$inline_1547 = + eventName$jscomp$inline_1545[0].toUpperCase() + + eventName$jscomp$inline_1545.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1538, - "on" + capitalizedEvent$jscomp$inline_1539 + domEventName$jscomp$inline_1546, + "on" + capitalizedEvent$jscomp$inline_1547 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16965,17 +17002,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1727 = { +var devToolsConfig$jscomp$inline_1735 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-aa655557", + version: "19.0.0-www-classic-9a5deb76", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2155 = { - bundleType: devToolsConfig$jscomp$inline_1727.bundleType, - version: devToolsConfig$jscomp$inline_1727.version, - rendererPackageName: devToolsConfig$jscomp$inline_1727.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1727.rendererConfig, +var internals$jscomp$inline_2166 = { + bundleType: devToolsConfig$jscomp$inline_1735.bundleType, + version: devToolsConfig$jscomp$inline_1735.version, + rendererPackageName: devToolsConfig$jscomp$inline_1735.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1735.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16991,26 +17028,26 @@ var internals$jscomp$inline_2155 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1727.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1735.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-aa655557" + reconcilerVersion: "19.0.0-www-classic-9a5deb76" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2156 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2167 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2156.isDisabled && - hook$jscomp$inline_2156.supportsFiber + !hook$jscomp$inline_2167.isDisabled && + hook$jscomp$inline_2167.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2156.inject( - internals$jscomp$inline_2155 + (rendererID = hook$jscomp$inline_2167.inject( + internals$jscomp$inline_2166 )), - (injectedHook = hook$jscomp$inline_2156); + (injectedHook = hook$jscomp$inline_2167); } catch (err) {} } var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); @@ -17461,4 +17498,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-aa655557"; +exports.version = "19.0.0-www-classic-9a5deb76"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 57409eac47..fe9f34e6d8 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -5930,10 +5930,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function checkDidRenderIdHook() { var didRenderIdHook = 0 !== localIdCounter; @@ -6733,9 +6739,23 @@ function startHostTransition(formFiber, pendingState, callback, formData) { queue: newQueue, next: null }; + var initialResetState = {}; + newQueue.next = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }, + next: null + }; formFiber.memoizedState = newQueue; - var alternate = formFiber.alternate; - null !== alternate && (alternate.memoizedState = newQueue); + initialResetState = formFiber.alternate; + null !== initialResetState && (initialResetState.memoizedState = newQueue); } else queue = formFiber.memoizedState.queue; startTransition( formFiber, @@ -6743,6 +6763,8 @@ function startHostTransition(formFiber, pendingState, callback, formData) { pendingState, sharedNotPendingObject, function () { + requestCurrentTransition(); + dispatchSetState(formFiber, formFiber.memoizedState.next.queue, {}); return callback(formData); } ); @@ -9870,6 +9892,7 @@ function resolveClassComponentProps( } var offscreenSubtreeIsHidden = !1, offscreenSubtreeWasHidden = !1, + needsFormReset = !1, PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, nextEffect = null; function callComponentWillUnmountWithTimer(current, instance) { @@ -10886,7 +10909,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -10926,11 +10949,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), null !== finishedWork && - ((current = finishedWork.callbacks), - null !== current && - ((flags = finishedWork.shared.hiddenCallbacks), + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), (finishedWork.shared.hiddenCallbacks = - null === flags ? current : flags.concat(current))))); + null === current ? flags : current.concat(flags))))); break; case 26: var hoistableRoot = currentHoistableRoot; @@ -10948,10 +10971,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === flags) if (null === finishedWork.stateNode) { a: { - current = finishedWork.type; - flags = finishedWork.memoizedProps; + flags = finishedWork.type; + current = finishedWork.memoizedProps; root = hoistableRoot.ownerDocument || hoistableRoot; - b: switch (current) { + b: switch (flags) { case "title": hoistableRoot = root.getElementsByTagName("title")[0]; if ( @@ -10962,42 +10985,42 @@ function commitMutationEffectsOnFiber(finishedWork, root) { hoistableRoot.namespaceURI || hoistableRoot.hasAttribute("itemprop") ) - (hoistableRoot = root.createElement(current)), + (hoistableRoot = root.createElement(flags)), root.head.insertBefore( hoistableRoot, root.querySelector("head > title") ); - setInitialProperties(hoistableRoot, current, flags); + setInitialProperties(hoistableRoot, flags, current); hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; break a; case "link": var maybeNodes = getHydratableHoistableCache( "link", "href", root - ).get(current + (flags.href || "")); + ).get(flags + (current.href || "")); if (maybeNodes) for (var i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("href") === - (null == flags.href ? null : flags.href) && + (null == current.href ? null : current.href) && hoistableRoot.getAttribute("rel") === - (null == flags.rel ? null : flags.rel) && + (null == current.rel ? null : current.rel) && hoistableRoot.getAttribute("title") === - (null == flags.title ? null : flags.title) && + (null == current.title ? null : current.title) && hoistableRoot.getAttribute("crossorigin") === - (null == flags.crossOrigin + (null == current.crossOrigin ? null - : flags.crossOrigin)) + : current.crossOrigin)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; case "meta": @@ -11006,43 +11029,45 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "meta", "content", root - ).get(current + (flags.content || ""))) + ).get(flags + (current.content || ""))) ) for (i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("content") === - (null == flags.content + (null == current.content ? null - : "" + flags.content) && + : "" + current.content) && hoistableRoot.getAttribute("name") === - (null == flags.name ? null : flags.name) && + (null == current.name ? null : current.name) && hoistableRoot.getAttribute("property") === - (null == flags.property + (null == current.property ? null - : flags.property) && + : current.property) && hoistableRoot.getAttribute("http-equiv") === - (null == flags.httpEquiv + (null == current.httpEquiv ? null - : flags.httpEquiv) && + : current.httpEquiv) && hoistableRoot.getAttribute("charset") === - (null == flags.charSet ? null : flags.charSet)) + (null == current.charSet + ? null + : current.charSet)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; default: - throw Error(formatProdErrorMessage(468, current)); + throw Error(formatProdErrorMessage(468, flags)); } hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; } - finishedWork.stateNode = current; + finishedWork.stateNode = flags; } else mountHoistable( hoistableRoot, @@ -11130,18 +11155,19 @@ function commitMutationEffectsOnFiber(finishedWork, root) { captureCommitPhaseError(finishedWork, finishedWork.return, error$193); } } - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - root = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : root; - hoistableRoot = finishedWork.type; + if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { + hoistableRoot = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : hoistableRoot; + maybeNodes = finishedWork.type; finishedWork.updateQueue = null; try { - updateProperties(flags, hoistableRoot, current, root), - (flags[internalPropsKey] = root); + updateProperties(root, maybeNodes, current, hoistableRoot), + (root[internalPropsKey] = hoistableRoot); } catch (error$196) { captureCommitPhaseError(finishedWork, finishedWork.return, error$196); } } + flags & 1024 && (needsFormReset = !0); break; case 6: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11149,10 +11175,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4) { if (null === finishedWork.stateNode) throw Error(formatProdErrorMessage(162)); - current = finishedWork.stateNode; - flags = finishedWork.memoizedProps; + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; try { - current.nodeValue = flags; + flags.nodeValue = current; } catch (error$197) { captureCommitPhaseError(finishedWork, finishedWork.return, error$197); } @@ -11171,15 +11197,17 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$198) { captureCommitPhaseError(finishedWork, finishedWork.return, error$198); } + needsFormReset && + ((needsFormReset = !1), recursivelyResetForms(finishedWork)); break; case 4: - current = currentHoistableRoot; + flags = currentHoistableRoot; currentHoistableRoot = getHoistableRoot( finishedWork.stateNode.containerInfo ); recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); - currentHoistableRoot = current; + currentHoistableRoot = flags; break; case 13: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11202,10 +11230,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$200) { captureCommitPhaseError(finishedWork, finishedWork.return, error$200); } - current = finishedWork.updateQueue; - null !== current && + flags = finishedWork.updateQueue; + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current)); + attachSuspenseRetryListeners(finishedWork, flags)); } break; case 22: @@ -11303,21 +11331,21 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = root.sibling; } flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && - ((flags = current.retryQueue), - null !== flags && - ((current.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, flags)))); + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && + ((flags = finishedWork.updateQueue), + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current))); + attachSuspenseRetryListeners(finishedWork, flags))); break; case 21: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11382,6 +11410,15 @@ function commitReconciliationEffects(finishedWork) { } flags & 4096 && (finishedWork.flags &= -4097); } +function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & 1024) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var fiber = parentFiber; + recursivelyResetForms(fiber); + 5 === fiber.tag && fiber.flags & 1024 && fiber.stateNode.reset(); + parentFiber = parentFiber.sibling; + } +} function recursivelyTraverseLayoutEffects(root, parentFiber) { if (parentFiber.subtreeFlags & 8772) for (parentFiber = parentFiber.child; null !== parentFiber; ) @@ -16327,17 +16364,17 @@ Internals.Events = [ restoreStateIfNeeded, unstable_batchedUpdates ]; -var devToolsConfig$jscomp$inline_1720 = { +var devToolsConfig$jscomp$inline_1728 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-a8c56702", + version: "19.0.0-www-modern-3deb7bff", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2157 = { - bundleType: devToolsConfig$jscomp$inline_1720.bundleType, - version: devToolsConfig$jscomp$inline_1720.version, - rendererPackageName: devToolsConfig$jscomp$inline_1720.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1720.rendererConfig, +var internals$jscomp$inline_2168 = { + bundleType: devToolsConfig$jscomp$inline_1728.bundleType, + version: devToolsConfig$jscomp$inline_1728.version, + rendererPackageName: devToolsConfig$jscomp$inline_1728.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1728.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16353,26 +16390,26 @@ var internals$jscomp$inline_2157 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1720.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1728.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-a8c56702" + reconcilerVersion: "19.0.0-www-modern-3deb7bff" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2158 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2169 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2158.isDisabled && - hook$jscomp$inline_2158.supportsFiber + !hook$jscomp$inline_2169.isDisabled && + hook$jscomp$inline_2169.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2158.inject( - internals$jscomp$inline_2157 + (rendererID = hook$jscomp$inline_2169.inject( + internals$jscomp$inline_2168 )), - (injectedHook = hook$jscomp$inline_2158); + (injectedHook = hook$jscomp$inline_2169); } catch (err) {} } var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); @@ -16665,4 +16702,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-a8c56702"; +exports.version = "19.0.0-www-modern-3deb7bff"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 9c1f3aa52a..b763851a17 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -3461,10 +3461,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function checkDidRenderIdHook() { var didRenderIdHook = 0 !== localIdCounter; @@ -4264,9 +4270,23 @@ function startHostTransition(formFiber, pendingState, callback, formData) { queue: newQueue, next: null }; + var initialResetState = {}; + newQueue.next = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }, + next: null + }; formFiber.memoizedState = newQueue; - var alternate = formFiber.alternate; - null !== alternate && (alternate.memoizedState = newQueue); + initialResetState = formFiber.alternate; + null !== initialResetState && (initialResetState.memoizedState = newQueue); } else queue = formFiber.memoizedState.queue; startTransition( formFiber, @@ -4274,6 +4294,8 @@ function startHostTransition(formFiber, pendingState, callback, formData) { pendingState, sharedNotPendingObject, function () { + requestCurrentTransition(); + dispatchSetState(formFiber, formFiber.memoizedState.next.queue, {}); return callback(formData); } ); @@ -8661,6 +8683,7 @@ function unwindInterruptedWork(current, interruptedWork) { } var offscreenSubtreeIsHidden = !1, offscreenSubtreeWasHidden = !1, + needsFormReset = !1, PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, nextEffect = null, inProgressLanes = null, @@ -9888,7 +9911,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -9945,11 +9968,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), null !== finishedWork && - ((current = finishedWork.callbacks), - null !== current && - ((flags = finishedWork.shared.hiddenCallbacks), + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), (finishedWork.shared.hiddenCallbacks = - null === flags ? current : flags.concat(current))))); + null === current ? flags : current.concat(flags))))); break; case 26: var hoistableRoot = currentHoistableRoot; @@ -9967,10 +9990,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === flags) if (null === finishedWork.stateNode) { a: { - current = finishedWork.type; - flags = finishedWork.memoizedProps; + flags = finishedWork.type; + current = finishedWork.memoizedProps; root = hoistableRoot.ownerDocument || hoistableRoot; - b: switch (current) { + b: switch (flags) { case "title": hoistableRoot = root.getElementsByTagName("title")[0]; if ( @@ -9981,42 +10004,42 @@ function commitMutationEffectsOnFiber(finishedWork, root) { hoistableRoot.namespaceURI || hoistableRoot.hasAttribute("itemprop") ) - (hoistableRoot = root.createElement(current)), + (hoistableRoot = root.createElement(flags)), root.head.insertBefore( hoistableRoot, root.querySelector("head > title") ); - setInitialProperties(hoistableRoot, current, flags); + setInitialProperties(hoistableRoot, flags, current); hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; break a; case "link": var maybeNodes = getHydratableHoistableCache( "link", "href", root - ).get(current + (flags.href || "")); + ).get(flags + (current.href || "")); if (maybeNodes) for (var i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("href") === - (null == flags.href ? null : flags.href) && + (null == current.href ? null : current.href) && hoistableRoot.getAttribute("rel") === - (null == flags.rel ? null : flags.rel) && + (null == current.rel ? null : current.rel) && hoistableRoot.getAttribute("title") === - (null == flags.title ? null : flags.title) && + (null == current.title ? null : current.title) && hoistableRoot.getAttribute("crossorigin") === - (null == flags.crossOrigin + (null == current.crossOrigin ? null - : flags.crossOrigin)) + : current.crossOrigin)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; case "meta": @@ -10025,43 +10048,45 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "meta", "content", root - ).get(current + (flags.content || ""))) + ).get(flags + (current.content || ""))) ) for (i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("content") === - (null == flags.content + (null == current.content ? null - : "" + flags.content) && + : "" + current.content) && hoistableRoot.getAttribute("name") === - (null == flags.name ? null : flags.name) && + (null == current.name ? null : current.name) && hoistableRoot.getAttribute("property") === - (null == flags.property + (null == current.property ? null - : flags.property) && + : current.property) && hoistableRoot.getAttribute("http-equiv") === - (null == flags.httpEquiv + (null == current.httpEquiv ? null - : flags.httpEquiv) && + : current.httpEquiv) && hoistableRoot.getAttribute("charset") === - (null == flags.charSet ? null : flags.charSet)) + (null == current.charSet + ? null + : current.charSet)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; default: - throw Error(formatProdErrorMessage(468, current)); + throw Error(formatProdErrorMessage(468, flags)); } hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; } - finishedWork.stateNode = current; + finishedWork.stateNode = flags; } else mountHoistable( hoistableRoot, @@ -10149,18 +10174,19 @@ function commitMutationEffectsOnFiber(finishedWork, root) { captureCommitPhaseError(finishedWork, finishedWork.return, error$186); } } - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - root = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : root; - hoistableRoot = finishedWork.type; + if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { + hoistableRoot = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : hoistableRoot; + maybeNodes = finishedWork.type; finishedWork.updateQueue = null; try { - updateProperties(flags, hoistableRoot, current, root), - (flags[internalPropsKey] = root); + updateProperties(root, maybeNodes, current, hoistableRoot), + (root[internalPropsKey] = hoistableRoot); } catch (error$189) { captureCommitPhaseError(finishedWork, finishedWork.return, error$189); } } + flags & 1024 && (needsFormReset = !0); break; case 6: recursivelyTraverseMutationEffects(root, finishedWork); @@ -10168,10 +10194,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4) { if (null === finishedWork.stateNode) throw Error(formatProdErrorMessage(162)); - current = finishedWork.stateNode; - flags = finishedWork.memoizedProps; + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; try { - current.nodeValue = flags; + flags.nodeValue = current; } catch (error$190) { captureCommitPhaseError(finishedWork, finishedWork.return, error$190); } @@ -10190,15 +10216,17 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$191) { captureCommitPhaseError(finishedWork, finishedWork.return, error$191); } + needsFormReset && + ((needsFormReset = !1), recursivelyResetForms(finishedWork)); break; case 4: - current = currentHoistableRoot; + flags = currentHoistableRoot; currentHoistableRoot = getHoistableRoot( finishedWork.stateNode.containerInfo ); recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); - currentHoistableRoot = current; + currentHoistableRoot = flags; break; case 13: recursivelyTraverseMutationEffects(root, finishedWork); @@ -10221,10 +10249,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$193) { captureCommitPhaseError(finishedWork, finishedWork.return, error$193); } - current = finishedWork.updateQueue; - null !== current && + flags = finishedWork.updateQueue; + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current)); + attachSuspenseRetryListeners(finishedWork, flags)); } break; case 22: @@ -10325,21 +10353,21 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = root.sibling; } flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && - ((flags = current.retryQueue), - null !== flags && - ((current.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, flags)))); + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && + ((flags = finishedWork.updateQueue), + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current))); + attachSuspenseRetryListeners(finishedWork, flags))); break; case 21: recursivelyTraverseMutationEffects(root, finishedWork); @@ -10404,6 +10432,15 @@ function commitReconciliationEffects(finishedWork) { } flags & 4096 && (finishedWork.flags &= -4097); } +function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & 1024) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var fiber = parentFiber; + recursivelyResetForms(fiber); + 5 === fiber.tag && fiber.flags & 1024 && fiber.stateNode.reset(); + parentFiber = parentFiber.sibling; + } +} function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; @@ -13766,14 +13803,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$373; if (canUseDOM) { - var isSupported$jscomp$inline_1581 = "oninput" in document; - if (!isSupported$jscomp$inline_1581) { - var element$jscomp$inline_1582 = document.createElement("div"); - element$jscomp$inline_1582.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1581 = - "function" === typeof element$jscomp$inline_1582.oninput; + var isSupported$jscomp$inline_1589 = "oninput" in document; + if (!isSupported$jscomp$inline_1589) { + var element$jscomp$inline_1590 = document.createElement("div"); + element$jscomp$inline_1590.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1589 = + "function" === typeof element$jscomp$inline_1590.oninput; } - JSCompiler_inline_result$jscomp$373 = isSupported$jscomp$inline_1581; + JSCompiler_inline_result$jscomp$373 = isSupported$jscomp$inline_1589; } else JSCompiler_inline_result$jscomp$373 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$373 && @@ -14154,20 +14191,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1622 = 0; - i$jscomp$inline_1622 < simpleEventPluginEvents.length; - i$jscomp$inline_1622++ + var i$jscomp$inline_1630 = 0; + i$jscomp$inline_1630 < simpleEventPluginEvents.length; + i$jscomp$inline_1630++ ) { - var eventName$jscomp$inline_1623 = - simpleEventPluginEvents[i$jscomp$inline_1622], - domEventName$jscomp$inline_1624 = - eventName$jscomp$inline_1623.toLowerCase(), - capitalizedEvent$jscomp$inline_1625 = - eventName$jscomp$inline_1623[0].toUpperCase() + - eventName$jscomp$inline_1623.slice(1); + var eventName$jscomp$inline_1631 = + simpleEventPluginEvents[i$jscomp$inline_1630], + domEventName$jscomp$inline_1632 = + eventName$jscomp$inline_1631.toLowerCase(), + capitalizedEvent$jscomp$inline_1633 = + eventName$jscomp$inline_1631[0].toUpperCase() + + eventName$jscomp$inline_1631.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1624, - "on" + capitalizedEvent$jscomp$inline_1625 + domEventName$jscomp$inline_1632, + "on" + capitalizedEvent$jscomp$inline_1633 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17713,10 +17750,10 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1813 = { +var devToolsConfig$jscomp$inline_1821 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-ad71efd0", + version: "19.0.0-www-classic-5c5eca68", rendererPackageName: "react-dom" }; (function (internals) { @@ -17734,10 +17771,10 @@ var devToolsConfig$jscomp$inline_1813 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1813.bundleType, - version: devToolsConfig$jscomp$inline_1813.version, - rendererPackageName: devToolsConfig$jscomp$inline_1813.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1813.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1821.bundleType, + version: devToolsConfig$jscomp$inline_1821.version, + rendererPackageName: devToolsConfig$jscomp$inline_1821.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1821.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17753,14 +17790,14 @@ var devToolsConfig$jscomp$inline_1813 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1813.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1821.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-ad71efd0" + reconcilerVersion: "19.0.0-www-classic-5c5eca68" }); var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); if ("function" !== typeof ReactFiberErrorDialogWWW.showErrorDialog) @@ -18210,7 +18247,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-ad71efd0"; +exports.version = "19.0.0-www-classic-5c5eca68"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index 44c0dc3946..cf0f3b9aed 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -6066,10 +6066,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function checkDidRenderIdHook() { var didRenderIdHook = 0 !== localIdCounter; @@ -6869,9 +6875,23 @@ function startHostTransition(formFiber, pendingState, callback, formData) { queue: newQueue, next: null }; + var initialResetState = {}; + newQueue.next = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }, + next: null + }; formFiber.memoizedState = newQueue; - var alternate = formFiber.alternate; - null !== alternate && (alternate.memoizedState = newQueue); + initialResetState = formFiber.alternate; + null !== initialResetState && (initialResetState.memoizedState = newQueue); } else queue = formFiber.memoizedState.queue; startTransition( formFiber, @@ -6879,6 +6899,8 @@ function startHostTransition(formFiber, pendingState, callback, formData) { pendingState, sharedNotPendingObject, function () { + requestCurrentTransition(); + dispatchSetState(formFiber, formFiber.memoizedState.next.queue, {}); return callback(formData); } ); @@ -10101,6 +10123,7 @@ function resolveClassComponentProps( } var offscreenSubtreeIsHidden = !1, offscreenSubtreeWasHidden = !1, + needsFormReset = !1, PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, nextEffect = null, inProgressLanes = null, @@ -11330,7 +11353,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -11387,11 +11410,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), null !== finishedWork && - ((current = finishedWork.callbacks), - null !== current && - ((flags = finishedWork.shared.hiddenCallbacks), + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), (finishedWork.shared.hiddenCallbacks = - null === flags ? current : flags.concat(current))))); + null === current ? flags : current.concat(flags))))); break; case 26: var hoistableRoot = currentHoistableRoot; @@ -11409,10 +11432,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === flags) if (null === finishedWork.stateNode) { a: { - current = finishedWork.type; - flags = finishedWork.memoizedProps; + flags = finishedWork.type; + current = finishedWork.memoizedProps; root = hoistableRoot.ownerDocument || hoistableRoot; - b: switch (current) { + b: switch (flags) { case "title": hoistableRoot = root.getElementsByTagName("title")[0]; if ( @@ -11423,42 +11446,42 @@ function commitMutationEffectsOnFiber(finishedWork, root) { hoistableRoot.namespaceURI || hoistableRoot.hasAttribute("itemprop") ) - (hoistableRoot = root.createElement(current)), + (hoistableRoot = root.createElement(flags)), root.head.insertBefore( hoistableRoot, root.querySelector("head > title") ); - setInitialProperties(hoistableRoot, current, flags); + setInitialProperties(hoistableRoot, flags, current); hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; break a; case "link": var maybeNodes = getHydratableHoistableCache( "link", "href", root - ).get(current + (flags.href || "")); + ).get(flags + (current.href || "")); if (maybeNodes) for (var i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("href") === - (null == flags.href ? null : flags.href) && + (null == current.href ? null : current.href) && hoistableRoot.getAttribute("rel") === - (null == flags.rel ? null : flags.rel) && + (null == current.rel ? null : current.rel) && hoistableRoot.getAttribute("title") === - (null == flags.title ? null : flags.title) && + (null == current.title ? null : current.title) && hoistableRoot.getAttribute("crossorigin") === - (null == flags.crossOrigin + (null == current.crossOrigin ? null - : flags.crossOrigin)) + : current.crossOrigin)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; case "meta": @@ -11467,43 +11490,45 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "meta", "content", root - ).get(current + (flags.content || ""))) + ).get(flags + (current.content || ""))) ) for (i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("content") === - (null == flags.content + (null == current.content ? null - : "" + flags.content) && + : "" + current.content) && hoistableRoot.getAttribute("name") === - (null == flags.name ? null : flags.name) && + (null == current.name ? null : current.name) && hoistableRoot.getAttribute("property") === - (null == flags.property + (null == current.property ? null - : flags.property) && + : current.property) && hoistableRoot.getAttribute("http-equiv") === - (null == flags.httpEquiv + (null == current.httpEquiv ? null - : flags.httpEquiv) && + : current.httpEquiv) && hoistableRoot.getAttribute("charset") === - (null == flags.charSet ? null : flags.charSet)) + (null == current.charSet + ? null + : current.charSet)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; default: - throw Error(formatProdErrorMessage(468, current)); + throw Error(formatProdErrorMessage(468, flags)); } hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; } - finishedWork.stateNode = current; + finishedWork.stateNode = flags; } else mountHoistable( hoistableRoot, @@ -11591,18 +11616,19 @@ function commitMutationEffectsOnFiber(finishedWork, root) { captureCommitPhaseError(finishedWork, finishedWork.return, error$207); } } - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - root = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : root; - hoistableRoot = finishedWork.type; + if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { + hoistableRoot = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : hoistableRoot; + maybeNodes = finishedWork.type; finishedWork.updateQueue = null; try { - updateProperties(flags, hoistableRoot, current, root), - (flags[internalPropsKey] = root); + updateProperties(root, maybeNodes, current, hoistableRoot), + (root[internalPropsKey] = hoistableRoot); } catch (error$210) { captureCommitPhaseError(finishedWork, finishedWork.return, error$210); } } + flags & 1024 && (needsFormReset = !0); break; case 6: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11610,10 +11636,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4) { if (null === finishedWork.stateNode) throw Error(formatProdErrorMessage(162)); - current = finishedWork.stateNode; - flags = finishedWork.memoizedProps; + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; try { - current.nodeValue = flags; + flags.nodeValue = current; } catch (error$211) { captureCommitPhaseError(finishedWork, finishedWork.return, error$211); } @@ -11632,15 +11658,17 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$212) { captureCommitPhaseError(finishedWork, finishedWork.return, error$212); } + needsFormReset && + ((needsFormReset = !1), recursivelyResetForms(finishedWork)); break; case 4: - current = currentHoistableRoot; + flags = currentHoistableRoot; currentHoistableRoot = getHoistableRoot( finishedWork.stateNode.containerInfo ); recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); - currentHoistableRoot = current; + currentHoistableRoot = flags; break; case 13: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11663,10 +11691,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$214) { captureCommitPhaseError(finishedWork, finishedWork.return, error$214); } - current = finishedWork.updateQueue; - null !== current && + flags = finishedWork.updateQueue; + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current)); + attachSuspenseRetryListeners(finishedWork, flags)); } break; case 22: @@ -11764,21 +11792,21 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = root.sibling; } flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && - ((flags = current.retryQueue), - null !== flags && - ((current.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, flags)))); + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && + ((flags = finishedWork.updateQueue), + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current))); + attachSuspenseRetryListeners(finishedWork, flags))); break; case 21: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11843,6 +11871,15 @@ function commitReconciliationEffects(finishedWork) { } flags & 4096 && (finishedWork.flags &= -4097); } +function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & 1024) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var fiber = parentFiber; + recursivelyResetForms(fiber); + 5 === fiber.tag && fiber.flags & 1024 && fiber.stateNode.reset(); + parentFiber = parentFiber.sibling; + } +} function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; @@ -17058,10 +17095,10 @@ Internals.Events = [ restoreStateIfNeeded, unstable_batchedUpdates ]; -var devToolsConfig$jscomp$inline_1806 = { +var devToolsConfig$jscomp$inline_1814 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-0707c07d", + version: "19.0.0-www-modern-f6515b25", rendererPackageName: "react-dom" }; (function (internals) { @@ -17079,10 +17116,10 @@ var devToolsConfig$jscomp$inline_1806 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1806.bundleType, - version: devToolsConfig$jscomp$inline_1806.version, - rendererPackageName: devToolsConfig$jscomp$inline_1806.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1806.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1814.bundleType, + version: devToolsConfig$jscomp$inline_1814.version, + rendererPackageName: devToolsConfig$jscomp$inline_1814.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1814.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17098,14 +17135,14 @@ var devToolsConfig$jscomp$inline_1806 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1806.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1814.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-0707c07d" + reconcilerVersion: "19.0.0-www-modern-f6515b25" }); var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); if ("function" !== typeof ReactFiberErrorDialogWWW.showErrorDialog) @@ -17397,7 +17434,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-0707c07d"; +exports.version = "19.0.0-www-modern-f6515b25"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index e99a046f71..e64f4231e2 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -543,6 +543,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -612,7 +613,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -14075,13 +14077,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function checkDidRenderIdHook() { // This should be called immediately after every renderWithHooks call. @@ -15981,7 +15999,29 @@ if (__DEV__) { baseQueue: null, queue: newQueue, next: null - }; // Add the state hook to both fiber alternates. The idea is that the fiber + }; // We use another state hook to track whether the form needs to be reset. + // The state is an empty object. To trigger a reset, we update the state + // to a new object. Then during rendering, we detect that the state has + // changed and schedule a commit effect. + + var initialResetState = {}; + var newResetStateQueue = { + pending: null, + lanes: NoLanes, + // We're going to cheat and intentionally not create a bound dispatch + // method, because we can call it directly in startTransition. + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }; + var resetStateHook = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: newResetStateQueue, + next: null + }; + stateHook.next = resetStateHook; // Add the hook list to both fiber alternates. The idea is that the fiber // had this hook all along. formFiber.memoizedState = stateHook; @@ -16003,11 +16043,40 @@ if (__DEV__) { NotPendingTransition, // TODO: We can avoid this extra wrapper, somehow. Figure out layering // once more of this function is implemented. function () { + // Automatically reset the form when the action completes. + requestFormReset(formFiber); return callback(formData); } ); } + function requestFormReset(formFiber) { + var transition = requestCurrentTransition(); + + { + if (transition === null) { + // An optimistic update occurred, but startTransition is not on the stack. + // The form reset will be scheduled at default (sync) priority, which + // is probably not what the user intended. Most likely because the + // requestFormReset call happened after an `await`. + // TODO: Theoretically, requestFormReset is still useful even for + // non-transition updates because it allows you to update defaultValue + // synchronously and then wait to reset until after the update commits. + // I've chosen to warn anyway because it's more likely the `await` mistake + // described above. But arguably we shouldn't. + error( + "requestFormReset was called outside a transition or action. To " + + "fix, move to an action, or wrap with startTransition." + ); + } + } + + var newResetState = {}; + var resetStateHook = formFiber.memoizedState.next; + var resetStateQueue = resetStateHook.queue; + dispatchSetState(formFiber, resetStateQueue, newResetState); + } + function mountTransition() { var stateHook = mountStateImpl(false); // The `start` method never changes. @@ -26694,7 +26763,9 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. + + var needsFormReset = false; var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -29290,6 +29361,21 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + needsFormReset = true; + + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -29360,6 +29446,20 @@ if (__DEV__) { } } + if (needsFormReset) { + // A form component requested to be reset during this commit. We do this + // after all mutations in the rest of the tree so that `defaultValue` + // will already be updated. This way you can update `defaultValue` using + // data sent by the server as a result of the form submission. + // + // Theoretically we could check finishedWork.subtreeFlags & FormReset, + // but the FormReset bit is overloaded with other flags used by other + // fiber types. So this extra variable lets us skip traversing the tree + // except when a form was actually submitted. + needsFormReset = false; + recursivelyResetForms(finishedWork); + } + return; } @@ -29587,6 +29687,26 @@ if (__DEV__) { } } + function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & FormReset) { + var child = parentFiber.child; + + while (child !== null) { + resetFormOnFiber(child); + child = child.sibling; + } + } + } + + function resetFormOnFiber(fiber) { + recursivelyResetForms(fiber); + + if (fiber.tag === HostComponent && fiber.flags & FormReset) { + var formInstance = fiber.stateNode; + resetFormInstance(formInstance); + } + } + function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; @@ -36719,7 +36839,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-classic-2d5b167c"; + var ReactVersion = "19.0.0-www-classic-cc9b0875"; function createPortal$1( children, @@ -47867,6 +47987,9 @@ if (__DEV__) { } var NotPendingTransition = NotPending; + function resetFormInstance(form) { + form.reset(); + } var randomKey = Math.random().toString(36).slice(2); var internalInstanceKey = "__reactFiber$" + randomKey; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index 3e82de60a8..8152b3dec7 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -187,6 +187,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var HostEffectMask = /* */ @@ -254,7 +255,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -21627,13 +21629,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function checkDidRenderIdHook() { // This should be called immediately after every renderWithHooks call. @@ -23533,7 +23551,29 @@ if (__DEV__) { baseQueue: null, queue: newQueue, next: null - }; // Add the state hook to both fiber alternates. The idea is that the fiber + }; // We use another state hook to track whether the form needs to be reset. + // The state is an empty object. To trigger a reset, we update the state + // to a new object. Then during rendering, we detect that the state has + // changed and schedule a commit effect. + + var initialResetState = {}; + var newResetStateQueue = { + pending: null, + lanes: NoLanes, + // We're going to cheat and intentionally not create a bound dispatch + // method, because we can call it directly in startTransition. + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }; + var resetStateHook = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: newResetStateQueue, + next: null + }; + stateHook.next = resetStateHook; // Add the hook list to both fiber alternates. The idea is that the fiber // had this hook all along. formFiber.memoizedState = stateHook; @@ -23555,11 +23595,40 @@ if (__DEV__) { NotPendingTransition, // TODO: We can avoid this extra wrapper, somehow. Figure out layering // once more of this function is implemented. function () { + // Automatically reset the form when the action completes. + requestFormReset(formFiber); return callback(formData); } ); } + function requestFormReset(formFiber) { + var transition = requestCurrentTransition(); + + { + if (transition === null) { + // An optimistic update occurred, but startTransition is not on the stack. + // The form reset will be scheduled at default (sync) priority, which + // is probably not what the user intended. Most likely because the + // requestFormReset call happened after an `await`. + // TODO: Theoretically, requestFormReset is still useful even for + // non-transition updates because it allows you to update defaultValue + // synchronously and then wait to reset until after the update commits. + // I've chosen to warn anyway because it's more likely the `await` mistake + // described above. But arguably we shouldn't. + error( + "requestFormReset was called outside a transition or action. To " + + "fix, move to an action, or wrap with startTransition." + ); + } + } + + var newResetState = {}; + var resetStateHook = formFiber.memoizedState.next; + var resetStateQueue = resetStateHook.queue; + dispatchSetState(formFiber, resetStateQueue, newResetState); + } + function mountTransition() { var stateHook = mountStateImpl(false); // The `start` method never changes. @@ -32215,7 +32284,9 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. + + var needsFormReset = false; var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -34805,6 +34876,21 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + needsFormReset = true; + + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -34875,6 +34961,20 @@ if (__DEV__) { } } + if (needsFormReset) { + // A form component requested to be reset during this commit. We do this + // after all mutations in the rest of the tree so that `defaultValue` + // will already be updated. This way you can update `defaultValue` using + // data sent by the server as a result of the form submission. + // + // Theoretically we could check finishedWork.subtreeFlags & FormReset, + // but the FormReset bit is overloaded with other flags used by other + // fiber types. So this extra variable lets us skip traversing the tree + // except when a form was actually submitted. + needsFormReset = false; + recursivelyResetForms(finishedWork); + } + return; } @@ -35100,6 +35200,26 @@ if (__DEV__) { } } + function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & FormReset) { + var child = parentFiber.child; + + while (child !== null) { + resetFormOnFiber(child); + child = child.sibling; + } + } + } + + function resetFormOnFiber(fiber) { + recursivelyResetForms(fiber); + + if (fiber.tag === HostComponent && fiber.flags & FormReset) { + var formInstance = fiber.stateNode; + resetFormInstance(formInstance); + } + } + function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; @@ -46188,6 +46308,9 @@ if (__DEV__) { } var NotPendingTransition = NotPending; + function resetFormInstance(form) { + form.reset(); + } function FiberRootNode( containerInfo, // $FlowFixMe[missing-local-annot] @@ -46342,7 +46465,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-modern-597a5662"; + var ReactVersion = "19.0.0-www-modern-73131b69"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 90dc4577cb..bd2bb4518e 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -3411,10 +3411,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function checkDidRenderIdHook() { var didRenderIdHook = 0 !== localIdCounter; @@ -4214,9 +4220,23 @@ function startHostTransition(formFiber, pendingState, callback, formData) { queue: newQueue, next: null }; + var initialResetState = {}; + newQueue.next = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }, + next: null + }; formFiber.memoizedState = newQueue; - var alternate = formFiber.alternate; - null !== alternate && (alternate.memoizedState = newQueue); + initialResetState = formFiber.alternate; + null !== initialResetState && (initialResetState.memoizedState = newQueue); } else queue = formFiber.memoizedState.queue; startTransition( formFiber, @@ -4224,6 +4244,8 @@ function startHostTransition(formFiber, pendingState, callback, formData) { pendingState, sharedNotPendingObject, function () { + requestCurrentTransition(); + dispatchSetState(formFiber, formFiber.memoizedState.next.queue, {}); return callback(formData); } ); @@ -8431,6 +8453,7 @@ function unwindInterruptedWork(current, interruptedWork) { } var offscreenSubtreeIsHidden = !1, offscreenSubtreeWasHidden = !1, + needsFormReset = !1, PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, nextEffect = null; function callComponentWillUnmountWithTimer(current, instance) { @@ -9445,7 +9468,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -9485,11 +9508,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), null !== finishedWork && - ((current = finishedWork.callbacks), - null !== current && - ((flags = finishedWork.shared.hiddenCallbacks), + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), (finishedWork.shared.hiddenCallbacks = - null === flags ? current : flags.concat(current))))); + null === current ? flags : current.concat(flags))))); break; case 26: var hoistableRoot = currentHoistableRoot; @@ -9507,10 +9530,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === flags) if (null === finishedWork.stateNode) { a: { - current = finishedWork.type; - flags = finishedWork.memoizedProps; + flags = finishedWork.type; + current = finishedWork.memoizedProps; root = hoistableRoot.ownerDocument || hoistableRoot; - b: switch (current) { + b: switch (flags) { case "title": hoistableRoot = root.getElementsByTagName("title")[0]; if ( @@ -9521,42 +9544,42 @@ function commitMutationEffectsOnFiber(finishedWork, root) { hoistableRoot.namespaceURI || hoistableRoot.hasAttribute("itemprop") ) - (hoistableRoot = root.createElement(current)), + (hoistableRoot = root.createElement(flags)), root.head.insertBefore( hoistableRoot, root.querySelector("head > title") ); - setInitialProperties(hoistableRoot, current, flags); + setInitialProperties(hoistableRoot, flags, current); hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; break a; case "link": var maybeNodes = getHydratableHoistableCache( "link", "href", root - ).get(current + (flags.href || "")); + ).get(flags + (current.href || "")); if (maybeNodes) for (var i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("href") === - (null == flags.href ? null : flags.href) && + (null == current.href ? null : current.href) && hoistableRoot.getAttribute("rel") === - (null == flags.rel ? null : flags.rel) && + (null == current.rel ? null : current.rel) && hoistableRoot.getAttribute("title") === - (null == flags.title ? null : flags.title) && + (null == current.title ? null : current.title) && hoistableRoot.getAttribute("crossorigin") === - (null == flags.crossOrigin + (null == current.crossOrigin ? null - : flags.crossOrigin)) + : current.crossOrigin)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; case "meta": @@ -9565,43 +9588,45 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "meta", "content", root - ).get(current + (flags.content || ""))) + ).get(flags + (current.content || ""))) ) for (i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("content") === - (null == flags.content + (null == current.content ? null - : "" + flags.content) && + : "" + current.content) && hoistableRoot.getAttribute("name") === - (null == flags.name ? null : flags.name) && + (null == current.name ? null : current.name) && hoistableRoot.getAttribute("property") === - (null == flags.property + (null == current.property ? null - : flags.property) && + : current.property) && hoistableRoot.getAttribute("http-equiv") === - (null == flags.httpEquiv + (null == current.httpEquiv ? null - : flags.httpEquiv) && + : current.httpEquiv) && hoistableRoot.getAttribute("charset") === - (null == flags.charSet ? null : flags.charSet)) + (null == current.charSet + ? null + : current.charSet)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; default: - throw Error(formatProdErrorMessage(468, current)); + throw Error(formatProdErrorMessage(468, flags)); } hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; } - finishedWork.stateNode = current; + finishedWork.stateNode = flags; } else mountHoistable( hoistableRoot, @@ -9689,18 +9714,19 @@ function commitMutationEffectsOnFiber(finishedWork, root) { captureCommitPhaseError(finishedWork, finishedWork.return, error$167); } } - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - root = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : root; - hoistableRoot = finishedWork.type; + if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { + hoistableRoot = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : hoistableRoot; + maybeNodes = finishedWork.type; finishedWork.updateQueue = null; try { - updateProperties(flags, hoistableRoot, current, root), - (flags[internalPropsKey] = root); + updateProperties(root, maybeNodes, current, hoistableRoot), + (root[internalPropsKey] = hoistableRoot); } catch (error$170) { captureCommitPhaseError(finishedWork, finishedWork.return, error$170); } } + flags & 1024 && (needsFormReset = !0); break; case 6: recursivelyTraverseMutationEffects(root, finishedWork); @@ -9708,10 +9734,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4) { if (null === finishedWork.stateNode) throw Error(formatProdErrorMessage(162)); - current = finishedWork.stateNode; - flags = finishedWork.memoizedProps; + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; try { - current.nodeValue = flags; + flags.nodeValue = current; } catch (error$171) { captureCommitPhaseError(finishedWork, finishedWork.return, error$171); } @@ -9730,15 +9756,17 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$172) { captureCommitPhaseError(finishedWork, finishedWork.return, error$172); } + needsFormReset && + ((needsFormReset = !1), recursivelyResetForms(finishedWork)); break; case 4: - current = currentHoistableRoot; + flags = currentHoistableRoot; currentHoistableRoot = getHoistableRoot( finishedWork.stateNode.containerInfo ); recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); - currentHoistableRoot = current; + currentHoistableRoot = flags; break; case 13: recursivelyTraverseMutationEffects(root, finishedWork); @@ -9761,10 +9789,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$174) { captureCommitPhaseError(finishedWork, finishedWork.return, error$174); } - current = finishedWork.updateQueue; - null !== current && + flags = finishedWork.updateQueue; + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current)); + attachSuspenseRetryListeners(finishedWork, flags)); } break; case 22: @@ -9865,21 +9893,21 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = root.sibling; } flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && - ((flags = current.retryQueue), - null !== flags && - ((current.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, flags)))); + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && + ((flags = finishedWork.updateQueue), + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current))); + attachSuspenseRetryListeners(finishedWork, flags))); break; case 21: recursivelyTraverseMutationEffects(root, finishedWork); @@ -9944,6 +9972,15 @@ function commitReconciliationEffects(finishedWork) { } flags & 4096 && (finishedWork.flags &= -4097); } +function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & 1024) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var fiber = parentFiber; + recursivelyResetForms(fiber); + 5 === fiber.tag && fiber.flags & 1024 && fiber.stateNode.reset(); + parentFiber = parentFiber.sibling; + } +} function recursivelyTraverseLayoutEffects(root, parentFiber) { if (parentFiber.subtreeFlags & 8772) for (parentFiber = parentFiber.child; null !== parentFiber; ) @@ -12785,7 +12822,7 @@ function injectIntoDevTools(devToolsConfig) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-5677d146" + reconcilerVersion: "19.0.0-www-classic-c4e53255" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; @@ -13334,14 +13371,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$354; if (canUseDOM) { - var isSupported$jscomp$inline_1522 = "oninput" in document; - if (!isSupported$jscomp$inline_1522) { - var element$jscomp$inline_1523 = document.createElement("div"); - element$jscomp$inline_1523.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1522 = - "function" === typeof element$jscomp$inline_1523.oninput; + var isSupported$jscomp$inline_1530 = "oninput" in document; + if (!isSupported$jscomp$inline_1530) { + var element$jscomp$inline_1531 = document.createElement("div"); + element$jscomp$inline_1531.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1530 = + "function" === typeof element$jscomp$inline_1531.oninput; } - JSCompiler_inline_result$jscomp$354 = isSupported$jscomp$inline_1522; + JSCompiler_inline_result$jscomp$354 = isSupported$jscomp$inline_1530; } else JSCompiler_inline_result$jscomp$354 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$354 && @@ -13722,20 +13759,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1563 = 0; - i$jscomp$inline_1563 < simpleEventPluginEvents.length; - i$jscomp$inline_1563++ + var i$jscomp$inline_1571 = 0; + i$jscomp$inline_1571 < simpleEventPluginEvents.length; + i$jscomp$inline_1571++ ) { - var eventName$jscomp$inline_1564 = - simpleEventPluginEvents[i$jscomp$inline_1563], - domEventName$jscomp$inline_1565 = - eventName$jscomp$inline_1564.toLowerCase(), - capitalizedEvent$jscomp$inline_1566 = - eventName$jscomp$inline_1564[0].toUpperCase() + - eventName$jscomp$inline_1564.slice(1); + var eventName$jscomp$inline_1572 = + simpleEventPluginEvents[i$jscomp$inline_1571], + domEventName$jscomp$inline_1573 = + eventName$jscomp$inline_1572.toLowerCase(), + capitalizedEvent$jscomp$inline_1574 = + eventName$jscomp$inline_1572[0].toUpperCase() + + eventName$jscomp$inline_1572.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1565, - "on" + capitalizedEvent$jscomp$inline_1566 + domEventName$jscomp$inline_1573, + "on" + capitalizedEvent$jscomp$inline_1574 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17341,7 +17378,7 @@ Internals.Events = [ injectIntoDevTools({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-5677d146", + version: "19.0.0-www-classic-c4e53255", rendererPackageName: "react-dom" }); var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); @@ -17474,7 +17511,7 @@ assign(Internals, { injectIntoDevTools({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-5677d146", + version: "19.0.0-www-classic-c4e53255", rendererPackageName: "react-dom" }); exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = @@ -17941,4 +17978,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-5677d146"; +exports.version = "19.0.0-www-classic-c4e53255"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index c360465c4a..27f5862866 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -6075,10 +6075,16 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactSharedInternals.H.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function checkDidRenderIdHook() { var didRenderIdHook = 0 !== localIdCounter; @@ -6878,9 +6884,23 @@ function startHostTransition(formFiber, pendingState, callback, formData) { queue: newQueue, next: null }; + var initialResetState = {}; + newQueue.next = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }, + next: null + }; formFiber.memoizedState = newQueue; - var alternate = formFiber.alternate; - null !== alternate && (alternate.memoizedState = newQueue); + initialResetState = formFiber.alternate; + null !== initialResetState && (initialResetState.memoizedState = newQueue); } else queue = formFiber.memoizedState.queue; startTransition( formFiber, @@ -6888,6 +6908,8 @@ function startHostTransition(formFiber, pendingState, callback, formData) { pendingState, sharedNotPendingObject, function () { + requestCurrentTransition(); + dispatchSetState(formFiber, formFiber.memoizedState.next.queue, {}); return callback(formData); } ); @@ -10015,6 +10037,7 @@ function resolveClassComponentProps( } var offscreenSubtreeIsHidden = !1, offscreenSubtreeWasHidden = !1, + needsFormReset = !1, PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, nextEffect = null; function callComponentWillUnmountWithTimer(current, instance) { @@ -11031,7 +11054,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -11071,11 +11094,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), null !== finishedWork && - ((current = finishedWork.callbacks), - null !== current && - ((flags = finishedWork.shared.hiddenCallbacks), + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), (finishedWork.shared.hiddenCallbacks = - null === flags ? current : flags.concat(current))))); + null === current ? flags : current.concat(flags))))); break; case 26: var hoistableRoot = currentHoistableRoot; @@ -11093,10 +11116,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === flags) if (null === finishedWork.stateNode) { a: { - current = finishedWork.type; - flags = finishedWork.memoizedProps; + flags = finishedWork.type; + current = finishedWork.memoizedProps; root = hoistableRoot.ownerDocument || hoistableRoot; - b: switch (current) { + b: switch (flags) { case "title": hoistableRoot = root.getElementsByTagName("title")[0]; if ( @@ -11107,42 +11130,42 @@ function commitMutationEffectsOnFiber(finishedWork, root) { hoistableRoot.namespaceURI || hoistableRoot.hasAttribute("itemprop") ) - (hoistableRoot = root.createElement(current)), + (hoistableRoot = root.createElement(flags)), root.head.insertBefore( hoistableRoot, root.querySelector("head > title") ); - setInitialProperties(hoistableRoot, current, flags); + setInitialProperties(hoistableRoot, flags, current); hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; break a; case "link": var maybeNodes = getHydratableHoistableCache( "link", "href", root - ).get(current + (flags.href || "")); + ).get(flags + (current.href || "")); if (maybeNodes) for (var i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("href") === - (null == flags.href ? null : flags.href) && + (null == current.href ? null : current.href) && hoistableRoot.getAttribute("rel") === - (null == flags.rel ? null : flags.rel) && + (null == current.rel ? null : current.rel) && hoistableRoot.getAttribute("title") === - (null == flags.title ? null : flags.title) && + (null == current.title ? null : current.title) && hoistableRoot.getAttribute("crossorigin") === - (null == flags.crossOrigin + (null == current.crossOrigin ? null - : flags.crossOrigin)) + : current.crossOrigin)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; case "meta": @@ -11151,43 +11174,45 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "meta", "content", root - ).get(current + (flags.content || ""))) + ).get(flags + (current.content || ""))) ) for (i = 0; i < maybeNodes.length; i++) if ( ((hoistableRoot = maybeNodes[i]), hoistableRoot.getAttribute("content") === - (null == flags.content + (null == current.content ? null - : "" + flags.content) && + : "" + current.content) && hoistableRoot.getAttribute("name") === - (null == flags.name ? null : flags.name) && + (null == current.name ? null : current.name) && hoistableRoot.getAttribute("property") === - (null == flags.property + (null == current.property ? null - : flags.property) && + : current.property) && hoistableRoot.getAttribute("http-equiv") === - (null == flags.httpEquiv + (null == current.httpEquiv ? null - : flags.httpEquiv) && + : current.httpEquiv) && hoistableRoot.getAttribute("charset") === - (null == flags.charSet ? null : flags.charSet)) + (null == current.charSet + ? null + : current.charSet)) ) { maybeNodes.splice(i, 1); break b; } - hoistableRoot = root.createElement(current); - setInitialProperties(hoistableRoot, current, flags); + hoistableRoot = root.createElement(flags); + setInitialProperties(hoistableRoot, flags, current); root.head.appendChild(hoistableRoot); break; default: - throw Error(formatProdErrorMessage(468, current)); + throw Error(formatProdErrorMessage(468, flags)); } hoistableRoot[internalInstanceKey] = finishedWork; markNodeAsHoistable(hoistableRoot); - current = hoistableRoot; + flags = hoistableRoot; } - finishedWork.stateNode = current; + finishedWork.stateNode = flags; } else mountHoistable( hoistableRoot, @@ -11275,18 +11300,19 @@ function commitMutationEffectsOnFiber(finishedWork, root) { captureCommitPhaseError(finishedWork, finishedWork.return, error$193); } } - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - root = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : root; - hoistableRoot = finishedWork.type; + if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { + hoistableRoot = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : hoistableRoot; + maybeNodes = finishedWork.type; finishedWork.updateQueue = null; try { - updateProperties(flags, hoistableRoot, current, root), - (flags[internalPropsKey] = root); + updateProperties(root, maybeNodes, current, hoistableRoot), + (root[internalPropsKey] = hoistableRoot); } catch (error$196) { captureCommitPhaseError(finishedWork, finishedWork.return, error$196); } } + flags & 1024 && (needsFormReset = !0); break; case 6: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11294,10 +11320,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4) { if (null === finishedWork.stateNode) throw Error(formatProdErrorMessage(162)); - current = finishedWork.stateNode; - flags = finishedWork.memoizedProps; + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; try { - current.nodeValue = flags; + flags.nodeValue = current; } catch (error$197) { captureCommitPhaseError(finishedWork, finishedWork.return, error$197); } @@ -11316,15 +11342,17 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$198) { captureCommitPhaseError(finishedWork, finishedWork.return, error$198); } + needsFormReset && + ((needsFormReset = !1), recursivelyResetForms(finishedWork)); break; case 4: - current = currentHoistableRoot; + flags = currentHoistableRoot; currentHoistableRoot = getHoistableRoot( finishedWork.stateNode.containerInfo ); recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); - currentHoistableRoot = current; + currentHoistableRoot = flags; break; case 13: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11347,10 +11375,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } catch (error$200) { captureCommitPhaseError(finishedWork, finishedWork.return, error$200); } - current = finishedWork.updateQueue; - null !== current && + flags = finishedWork.updateQueue; + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current)); + attachSuspenseRetryListeners(finishedWork, flags)); } break; case 22: @@ -11448,21 +11476,21 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = root.sibling; } flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && - ((flags = current.retryQueue), - null !== flags && - ((current.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, flags)))); + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 4 && - ((current = finishedWork.updateQueue), - null !== current && + ((flags = finishedWork.updateQueue), + null !== flags && ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, current))); + attachSuspenseRetryListeners(finishedWork, flags))); break; case 21: recursivelyTraverseMutationEffects(root, finishedWork); @@ -11527,6 +11555,15 @@ function commitReconciliationEffects(finishedWork) { } flags & 4096 && (finishedWork.flags &= -4097); } +function recursivelyResetForms(parentFiber) { + if (parentFiber.subtreeFlags & 1024) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var fiber = parentFiber; + recursivelyResetForms(fiber); + 5 === fiber.tag && fiber.flags & 1024 && fiber.stateNode.reset(); + parentFiber = parentFiber.sibling; + } +} function recursivelyTraverseLayoutEffects(root, parentFiber) { if (parentFiber.subtreeFlags & 8772) for (parentFiber = parentFiber.child; null !== parentFiber; ) @@ -16064,7 +16101,7 @@ function injectIntoDevTools(devToolsConfig) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-f0b3cd72" + reconcilerVersion: "19.0.0-www-modern-4ee88fe7" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; @@ -16762,7 +16799,7 @@ Internals.Events = [ injectIntoDevTools({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-f0b3cd72", + version: "19.0.0-www-modern-4ee88fe7", rendererPackageName: "react-dom" }); if ("function" !== typeof require("ReactFiberErrorDialog").showErrorDialog) @@ -16770,7 +16807,7 @@ if ("function" !== typeof require("ReactFiberErrorDialog").showErrorDialog) injectIntoDevTools({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-f0b3cd72", + version: "19.0.0-www-modern-4ee88fe7", rendererPackageName: "react-dom" }); exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = @@ -17184,4 +17221,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-f0b3cd72"; +exports.version = "19.0.0-www-modern-4ee88fe7"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index e4f7809f93..e87c9521fc 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -512,6 +512,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -570,7 +571,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -8286,13 +8288,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the @@ -18901,7 +18919,7 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -20832,6 +20850,19 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -26656,7 +26687,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-classic-29f80d01"; + var ReactVersion = "19.0.0-www-classic-55753825"; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index b6a924637f..2147b9cee6 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -512,6 +512,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -570,7 +571,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -8286,13 +8288,29 @@ if (__DEV__) { var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the @@ -18901,7 +18919,7 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -20832,6 +20850,19 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -26656,7 +26687,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-modern-29f80d01"; + var ReactVersion = "19.0.0-www-modern-55753825"; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js index cebb933df7..a06cfef7c1 100644 --- a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js +++ b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js @@ -301,6 +301,7 @@ export default [ "Touch with identifier %s does not exist. Cannot record touch end without a touch start.", "Touch with identifier %s does not exist. Cannot record touch move without a touch start.", "Unexpected Fiber popped.", + "Unexpected host component type. Expected a form. This is a bug in React.", "Unexpected pop.", "Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", "Unexpected return value from a callback ref in %s. A callback ref should not return a function.", @@ -384,6 +385,7 @@ export default [ "precomputed chunks must be smaller than the view size configured for this host. This is a bug in React.", "propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.", "react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer", + "requestFormReset was called outside a transition or action. To fix, move to an action, or wrap with startTransition.", "root.finishedLanes should not be empty during a commit. This is a bug in React.", "sendAccessibilityEvent was called with a ref that isn't a native component. Use React.forwardRef to get access to the underlying native component", "unmountComponentAtNode was removed in React 19. Use root.unmount() instead.",