Skip to content

Commit 62feb18

Browse files
committed
Filter don't delete tail nodes of forms
This lets us put extra data to encode actions at the end.
1 parent 4cbdc87 commit 62feb18

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
enableHostSingletons,
9090
enableTrustedTypesIntegration,
9191
diffInCommitPhase,
92+
enableFormActions,
9293
} from 'shared/ReactFeatureFlags';
9394
import {
9495
HostComponent,
@@ -1419,12 +1420,14 @@ export function commitHydratedSuspenseInstance(
14191420
retryIfBlockedOn(suspenseInstance);
14201421
}
14211422

1422-
// @TODO remove this function once float lands and hydrated tail nodes
1423-
// are controlled by HostSingleton fibers
14241423
export function shouldDeleteUnhydratedTailInstances(
14251424
parentType: string,
14261425
): boolean {
1427-
return parentType !== 'head' && parentType !== 'body';
1426+
return (
1427+
(enableHostSingletons ||
1428+
(parentType !== 'head' && parentType !== 'body')) &&
1429+
(!enableFormActions || parentType !== 'form')
1430+
);
14281431
}
14291432

14301433
export function didNotMatchHydratedContainerTextInstance(

packages/react-reconciler/src/ReactFiberHydrationContext.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ function popHydrationState(fiber: Fiber): boolean {
802802
fiber.tag !== HostSingleton &&
803803
!(
804804
fiber.tag === HostComponent &&
805-
shouldSetTextContent(fiber.type, fiber.memoizedProps)
805+
(!shouldDeleteUnhydratedTailInstances(fiber.type) ||
806+
shouldSetTextContent(fiber.type, fiber.memoizedProps))
806807
)
807808
) {
808809
shouldClear = true;

0 commit comments

Comments
 (0)