Skip to content

Commit 86ec758

Browse files
authored
Merge branch 'main' into issue-31578-setter-arity-gcc
2 parents 49eea1c + 6a4b46c commit 86ec758

32 files changed

+450
-406
lines changed

packages/react-dom/src/__tests__/ReactDOMSelect-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,9 +911,7 @@ describe('ReactDOMSelect', () => {
911911
const container = document.createElement('div');
912912
const root = ReactDOMClient.createRoot(container);
913913
async function changeView() {
914-
await act(() => {
915-
root.unmount();
916-
});
914+
root.unmount();
917915
}
918916

919917
const stub = (

packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3743,6 +3743,10 @@ describe('ReactDOMServerPartialHydration', () => {
37433743
await waitForPaint(['App']);
37443744
expect(visibleRef.current).toBe(visibleSpan);
37453745

3746+
if (gate(flags => flags.enableYieldingBeforePassive)) {
3747+
// Passive effects.
3748+
await waitForPaint([]);
3749+
}
37463750
// Subsequently, the hidden child is prerendered on the client
37473751
await waitForPaint(['HiddenChild']);
37483752
expect(container).toMatchInlineSnapshot(`

packages/react-dom/src/__tests__/ReactLegacyContextDisabled-test.internal.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,7 @@ describe('ReactLegacyContextDisabled', () => {
233233
);
234234
});
235235
expect(container.textContent).toBe('bbb');
236-
if (gate(flags => flags.enableLazyContextPropagation)) {
237-
// In the lazy propagation implementation, we don't check if context
238-
// changed until after shouldComponentUpdate is run.
239-
expect(lifecycleContextLog).toEqual(['b', 'b', 'b']);
240-
} else {
241-
// In the eager implementation, a dirty flag was set when the parent
242-
// changed, so we skipped sCU.
243-
expect(lifecycleContextLog).toEqual(['b', 'b']);
244-
}
236+
expect(lifecycleContextLog).toEqual(['b', 'b', 'b']);
245237
root.unmount();
246238
});
247239
});

packages/react-reconciler/src/ReactFiberBeginWork.js

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ import type {
3737
import type {UpdateQueue} from './ReactFiberClassUpdateQueue';
3838
import type {RootState} from './ReactFiberRoot';
3939
import type {TracingMarkerInstance} from './ReactFiberTracingMarkerComponent';
40-
import type {TransitionStatus} from './ReactFiberConfig';
41-
import type {Hook} from './ReactFiberHooks';
4240

4341
import {
4442
markComponentRenderStarted,
@@ -100,7 +98,6 @@ import {
10098
enableProfilerCommitHooks,
10199
enableProfilerTimer,
102100
enableScopeAPI,
103-
enableLazyContextPropagation,
104101
enableSchedulingProfiler,
105102
enableTransitionTracing,
106103
enableLegacyHidden,
@@ -272,7 +269,6 @@ import {
272269
createClassErrorUpdate,
273270
initializeClassErrorUpdate,
274271
} from './ReactFiberThrow';
275-
import is from 'shared/objectIs';
276272
import {
277273
getForksAtLevel,
278274
isForkedChild,
@@ -843,7 +839,7 @@ function deferHiddenOffscreenComponent(
843839

844840
pushOffscreenSuspenseHandler(workInProgress);
845841

846-
if (enableLazyContextPropagation && current !== null) {
842+
if (current !== null) {
847843
// Since this tree will resume rendering in a separate render, we need
848844
// to propagate parent contexts now so we don't lose track of which
849845
// ones changed.
@@ -1636,26 +1632,6 @@ function updateHostComponent(
16361632
} else {
16371633
HostTransitionContext._currentValue2 = newState;
16381634
}
1639-
if (enableLazyContextPropagation) {
1640-
// In the lazy propagation implementation, we don't scan for matching
1641-
// consumers until something bails out.
1642-
} else {
1643-
if (didReceiveUpdate) {
1644-
if (current !== null) {
1645-
const oldStateHook: Hook = current.memoizedState;
1646-
const oldState: TransitionStatus = oldStateHook.memoizedState;
1647-
// This uses regular equality instead of Object.is because we assume
1648-
// that host transition state doesn't include NaN as a valid type.
1649-
if (oldState !== newState) {
1650-
propagateContextChange(
1651-
workInProgress,
1652-
HostTransitionContext,
1653-
renderLanes,
1654-
);
1655-
}
1656-
}
1657-
}
1658-
}
16591635
}
16601636

16611637
markRef(current, workInProgress);
@@ -2706,10 +2682,7 @@ function updateDehydratedSuspenseComponent(
27062682
}
27072683

27082684
if (
2709-
enableLazyContextPropagation &&
27102685
// TODO: Factoring is a little weird, since we check this right below, too.
2711-
// But don't want to re-arrange the if-else chain until/unless this
2712-
// feature lands.
27132686
!didReceiveUpdate
27142687
) {
27152688
// We need to check if any children have context before we decide to bail
@@ -3300,8 +3273,6 @@ function updateContextProvider(
33003273
context = workInProgress.type._context;
33013274
}
33023275
const newProps = workInProgress.pendingProps;
3303-
const oldProps = workInProgress.memoizedProps;
3304-
33053276
const newValue = newProps.value;
33063277

33073278
if (__DEV__) {
@@ -3317,34 +3288,6 @@ function updateContextProvider(
33173288

33183289
pushProvider(workInProgress, context, newValue);
33193290

3320-
if (enableLazyContextPropagation) {
3321-
// In the lazy propagation implementation, we don't scan for matching
3322-
// consumers until something bails out, because until something bails out
3323-
// we're going to visit those nodes, anyway. The trade-off is that it shifts
3324-
// responsibility to the consumer to track whether something has changed.
3325-
} else {
3326-
if (oldProps !== null) {
3327-
const oldValue = oldProps.value;
3328-
if (is(oldValue, newValue)) {
3329-
// No change. Bailout early if children are the same.
3330-
if (
3331-
oldProps.children === newProps.children &&
3332-
!hasLegacyContextChanged()
3333-
) {
3334-
return bailoutOnAlreadyFinishedWork(
3335-
current,
3336-
workInProgress,
3337-
renderLanes,
3338-
);
3339-
}
3340-
} else {
3341-
// The context value changed. Search for matching consumers and schedule
3342-
// them to update.
3343-
propagateContextChange(workInProgress, context, renderLanes);
3344-
}
3345-
}
3346-
}
3347-
33483291
const newChildren = newProps.children;
33493292
reconcileChildren(current, workInProgress, newChildren, renderLanes);
33503293
return workInProgress.child;
@@ -3463,7 +3406,7 @@ function bailoutOnAlreadyFinishedWork(
34633406
// TODO: Once we add back resuming, we should check if the children are
34643407
// a work-in-progress set. If so, we need to transfer their effects.
34653408

3466-
if (enableLazyContextPropagation && current !== null) {
3409+
if (current !== null) {
34673410
// Before bailing out, check if there are any context changes in
34683411
// the children.
34693412
lazilyPropagateParentContextChanges(current, workInProgress, renderLanes);
@@ -3564,11 +3507,9 @@ function checkScheduledUpdateOrContext(
35643507
}
35653508
// No pending update, but because context is propagated lazily, we need
35663509
// to check for a context change before we bail out.
3567-
if (enableLazyContextPropagation) {
3568-
const dependencies = current.dependencies;
3569-
if (dependencies !== null && checkIfContextChanged(dependencies)) {
3570-
return true;
3571-
}
3510+
const dependencies = current.dependencies;
3511+
if (dependencies !== null && checkIfContextChanged(dependencies)) {
3512+
return true;
35723513
}
35733514
return false;
35743515
}
@@ -3706,7 +3647,7 @@ function attemptEarlyBailoutIfNoScheduledUpdate(
37063647
workInProgress.childLanes,
37073648
);
37083649

3709-
if (enableLazyContextPropagation && !hasChildWork) {
3650+
if (!hasChildWork) {
37103651
// Context changes may not have been propagated yet. We need to do
37113652
// that now, before we can decide whether to bail out.
37123653
// TODO: We use `childLanes` as a heuristic for whether there is

packages/react-reconciler/src/ReactFiberClassComponent.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
debugRenderPhaseSideEffectsForStrictMode,
2222
disableLegacyContext,
2323
enableSchedulingProfiler,
24-
enableLazyContextPropagation,
2524
disableDefaultPropsExceptForClasses,
2625
} from 'shared/ReactFeatureFlags';
2726
import ReactStrictModeWarnings from './ReactStrictModeWarnings';
@@ -1092,7 +1091,6 @@ function updateClassInstance(
10921091
!hasContextChanged() &&
10931092
!checkHasForceUpdateAfterProcessing() &&
10941093
!(
1095-
enableLazyContextPropagation &&
10961094
current !== null &&
10971095
current.dependencies !== null &&
10981096
checkIfContextChanged(current.dependencies)
@@ -1144,8 +1142,7 @@ function updateClassInstance(
11441142
// both before and after `shouldComponentUpdate` has been called. Not ideal,
11451143
// but I'm loath to refactor this function. This only happens for memoized
11461144
// components so it's not that common.
1147-
(enableLazyContextPropagation &&
1148-
current !== null &&
1145+
(current !== null &&
11491146
current.dependencies !== null &&
11501147
checkIfContextChanged(current.dependencies));
11511148

0 commit comments

Comments
 (0)