Skip to content

Commit 0e1e97c

Browse files
committed
Update
[ghstack-poisoned]
2 parents ea9de6e + d3ef3f8 commit 0e1e97c

31 files changed

+163
-68
lines changed

Diff for: .github/workflows/runtime_build.yml

+17-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ on:
55
branches: [main]
66
pull_request:
77
paths-ignore:
8-
- 'compiler/**'
8+
- compiler/**
9+
10+
env:
11+
TZ: /usr/share/zoneinfo/America/Los_Angeles
912

1013
jobs:
1114
build_and_lint:
@@ -20,17 +23,21 @@ jobs:
2023
- uses: actions/checkout@v4
2124
- uses: actions/setup-node@v4
2225
with:
23-
node-version: 18.x
24-
cache: "yarn"
26+
node-version: 18.20.1
27+
cache: yarn
2528
cache-dependency-path: yarn.lock
29+
- uses: actions/setup-java@v4
30+
with:
31+
distribution: temurin
32+
java-version: 11.0.22
2633
- name: Restore cached node_modules
2734
uses: actions/cache@v4
2835
id: node_modules
2936
with:
3037
path: "**/node_modules"
3138
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
3239
- run: yarn install --frozen-lockfile
33-
- run: NODE_ENV=development yarn build --index=${{ matrix.worker_id }} --total=20 --r=${{ matrix.release_channel }} --ci=github
40+
- run: yarn build --index=${{ matrix.worker_id }} --total=20 --r=${{ matrix.release_channel }} --ci=github
3441
env:
3542
CI: github
3643
RELEASE_CHANNEL: ${{ matrix.release_channel }}
@@ -87,8 +94,8 @@ jobs:
8794
- uses: actions/checkout@v4
8895
- uses: actions/setup-node@v4
8996
with:
90-
node-version: 18.x
91-
cache: "yarn"
97+
node-version: 18.20.1
98+
cache: yarn
9299
cache-dependency-path: yarn.lock
93100
- name: Restore cached node_modules
94101
uses: actions/cache@v4
@@ -114,8 +121,8 @@ jobs:
114121
- uses: actions/checkout@v4
115122
- uses: actions/setup-node@v4
116123
with:
117-
node-version: 18.x
118-
cache: "yarn"
124+
node-version: 18.20.1
125+
cache: yarn
119126
cache-dependency-path: yarn.lock
120127
- name: Restore cached node_modules
121128
uses: actions/cache@v4
@@ -129,6 +136,8 @@ jobs:
129136
with:
130137
path: build
131138
merge-multiple: true
139+
- name: Display structure of build
140+
run: ls -R build
132141
- run: echo ${{ github.sha }} >> build/COMMIT_SHA
133142
- name: Scrape warning messages
134143
run: |

Diff for: packages/react-client/src/ReactClientConsoleConfigBrowser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export function printToConsole(
6565
);
6666
}
6767

68-
if (methodName === 'error') {
68+
if (methodName === 'error' && __DEV__) {
6969
error.apply(console, newArgs);
70-
} else if (methodName === 'warn') {
70+
} else if (methodName === 'warn' && __DEV__) {
7171
warn.apply(console, newArgs);
7272
} else {
7373
// $FlowFixMe[invalid-computed-prop]

Diff for: packages/react-client/src/ReactClientConsoleConfigPlain.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export function printToConsole(
4646
newArgs.splice(offset, 0, badgeFormat, pad + badgeName + pad);
4747
}
4848

49-
if (methodName === 'error') {
49+
if (methodName === 'error' && __DEV__) {
5050
error.apply(console, newArgs);
51-
} else if (methodName === 'warn') {
51+
} else if (methodName === 'warn' && __DEV__) {
5252
warn.apply(console, newArgs);
5353
} else {
5454
// $FlowFixMe[invalid-computed-prop]

Diff for: packages/react-client/src/ReactClientConsoleConfigServer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export function printToConsole(
6666
);
6767
}
6868

69-
if (methodName === 'error') {
69+
if (methodName === 'error' && __DEV__) {
7070
error.apply(console, newArgs);
71-
} else if (methodName === 'warn') {
71+
} else if (methodName === 'warn' && __DEV__) {
7272
warn.apply(console, newArgs);
7373
} else {
7474
// $FlowFixMe[invalid-computed-prop]

Diff for: packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js

+24
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ describe('ReactDOMServerIntegration', () => {
8686
});
8787

8888
itRenders('stateless child with context', async render => {
89+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
90+
return;
91+
}
8992
function FunctionChildWithContext(props, context) {
9093
return <div>{context.text}</div>;
9194
}
@@ -118,6 +121,9 @@ describe('ReactDOMServerIntegration', () => {
118121
});
119122

120123
itRenders('stateless child without context', async render => {
124+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
125+
return;
126+
}
121127
function FunctionChildWithoutContext(props, context) {
122128
// this should render blank; context isn't passed to this component.
123129
return <div>{context.text}</div>;
@@ -151,6 +157,9 @@ describe('ReactDOMServerIntegration', () => {
151157
});
152158

153159
itRenders('stateless child with wrong context', async render => {
160+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
161+
return;
162+
}
154163
function FunctionChildWithWrongContext(props, context) {
155164
// this should render blank; context.text isn't passed to this component.
156165
return <div id="statelessWrongChild">{context.text}</div>;
@@ -169,6 +178,9 @@ describe('ReactDOMServerIntegration', () => {
169178
});
170179

171180
itRenders('with context passed through to a grandchild', async render => {
181+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
182+
return;
183+
}
172184
function Grandchild(props, context) {
173185
return <div>{context.text}</div>;
174186
}
@@ -186,6 +198,9 @@ describe('ReactDOMServerIntegration', () => {
186198
});
187199

188200
itRenders('a child context overriding a parent context', async render => {
201+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
202+
return;
203+
}
189204
const Grandchild = (props, context) => {
190205
return <div>{context.text}</div>;
191206
};
@@ -203,6 +218,9 @@ describe('ReactDOMServerIntegration', () => {
203218
});
204219

205220
itRenders('a child context merged with a parent context', async render => {
221+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
222+
return;
223+
}
206224
class Parent extends React.Component {
207225
getChildContext() {
208226
return {text1: 'purple'};
@@ -244,6 +262,9 @@ describe('ReactDOMServerIntegration', () => {
244262
itRenders(
245263
'with a call to componentWillMount before getChildContext',
246264
async render => {
265+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
266+
return;
267+
}
247268
class WillMountContext extends React.Component {
248269
getChildContext() {
249270
return {text: this.state.text};
@@ -270,6 +291,9 @@ describe('ReactDOMServerIntegration', () => {
270291
itRenders(
271292
'if getChildContext exists but childContextTypes is missing with a warning',
272293
async render => {
294+
if (gate(flags => flags.disableLegacyContextForFunctionComponents)) {
295+
return;
296+
}
273297
function HopefulChild(props, context) {
274298
return context.foo || 'nope';
275299
}

Diff for: packages/react-dom/src/__tests__/ReactFunctionComponent-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ describe('ReactFunctionComponent', () => {
451451
]);
452452
});
453453

454-
// @gate !disableLegacyContext
454+
// @gate !disableLegacyContext && !disableLegacyContextForFunctionComponents
455455
it('should receive context', async () => {
456456
class Parent extends React.Component {
457457
static childContextTypes = {

Diff for: packages/react-native-renderer/src/ReactNativeTypes.js

+2
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ export type ViewConfig = $ReadOnly<{
8585
}>,
8686
...
8787
}>,
88+
supportsRawText?: boolean,
8889
uiViewClassName: string,
8990
validAttributes: AttributeConfiguration,
9091
}>;
9192

9293
export type PartialViewConfig = $ReadOnly<{
9394
bubblingEventTypes?: $PropertyType<ViewConfig, 'bubblingEventTypes'>,
9495
directEventTypes?: $PropertyType<ViewConfig, 'directEventTypes'>,
96+
supportsRawText?: boolean,
9597
uiViewClassName: string,
9698
validAttributes?: PartialAttributeConfiguration,
9799
}>;

Diff for: packages/react-reconciler/src/ReactCurrentFiber.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function getCurrentFiberOwnerNameInDevOrNull(): string | null {
3333
return null;
3434
}
3535

36-
function getCurrentFiberStackInDev(stack: null | Error): string {
36+
function getCurrentFiberStackInDev(): string {
3737
if (__DEV__) {
3838
if (current === null) {
3939
return '';
@@ -43,7 +43,7 @@ function getCurrentFiberStackInDev(stack: null | Error): string {
4343
// TODO: The above comment is not actually true. We might be
4444
// in a commit phase or preemptive set state callback.
4545
if (enableOwnerStacks) {
46-
return getOwnerStackByFiberInDev(current, stack);
46+
return getOwnerStackByFiberInDev(current);
4747
}
4848
return getStackByFiberInDevAndProd(current);
4949
}

Diff for: packages/react-reconciler/src/ReactFiberBeginWork.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ import {
9595
import {
9696
debugRenderPhaseSideEffectsForStrictMode,
9797
disableLegacyContext,
98+
disableLegacyContextForFunctionComponents,
9899
enableProfilerCommitHooks,
99100
enableProfilerTimer,
100101
enableScopeAPI,
@@ -1158,7 +1159,7 @@ function updateFunctionComponent(
11581159
}
11591160

11601161
let context;
1161-
if (!disableLegacyContext) {
1162+
if (!disableLegacyContext && !disableLegacyContextForFunctionComponents) {
11621163
const unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
11631164
context = getMaskedContext(workInProgress, unmaskedContext);
11641165
}

Diff for: packages/react-reconciler/src/ReactFiberComponentStack.js

+1-15
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,13 @@ function describeFunctionComponentFrameWithoutLineNumber(fn: Function): string {
9191
return name ? describeBuiltInComponentFrame(name) : '';
9292
}
9393

94-
export function getOwnerStackByFiberInDev(
95-
workInProgress: Fiber,
96-
topStack: null | Error,
97-
): string {
94+
export function getOwnerStackByFiberInDev(workInProgress: Fiber): string {
9895
if (!enableOwnerStacks || !__DEV__) {
9996
return '';
10097
}
10198
try {
10299
let info = '';
103100

104-
if (topStack) {
105-
// Prefix with a filtered version of the currently executing
106-
// stack. This information will be available in the native
107-
// stack regardless but it's hidden since we're reprinting
108-
// the stack on top of it.
109-
const formattedTopStack = formatOwnerStack(topStack);
110-
if (formattedTopStack !== '') {
111-
info += '\n' + formattedTopStack;
112-
}
113-
}
114-
115101
if (workInProgress.tag === HostText) {
116102
// Text nodes never have an owner/stack because they're not created through JSX.
117103
// We use the parent since text nodes are always created through a host parent.

Diff for: packages/react-reconciler/src/__tests__/ReactIncremental-test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@ describe('ReactIncremental', () => {
17011701
expect(instance.state.n).toEqual(3);
17021702
});
17031703

1704-
// @gate !disableLegacyContext
1704+
// @gate !disableLegacyContext && !disableLegacyContextForFunctionComponents
17051705
it('merges and masks context', async () => {
17061706
class Intl extends React.Component {
17071707
static childContextTypes = {
@@ -1954,7 +1954,7 @@ describe('ReactIncremental', () => {
19541954
]);
19551955
});
19561956

1957-
// @gate !disableLegacyContext
1957+
// @gate !disableLegacyContext && !disableLegacyContextForFunctionComponents
19581958
it('reads context when setState is below the provider', async () => {
19591959
let statefulInst;
19601960

@@ -2046,7 +2046,7 @@ describe('ReactIncremental', () => {
20462046
assertLog([]);
20472047
});
20482048

2049-
// @gate !disableLegacyContext
2049+
// @gate !disableLegacyContext && !disableLegacyContextForFunctionComponents
20502050
it('reads context when setState is above the provider', async () => {
20512051
let statefulInst;
20522052

Diff for: packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ describe('ReactIncrementalErrorHandling', () => {
11581158
// because it's used for new context, suspense, and many other features.
11591159
// It has to be tested independently for each feature anyway. So although it
11601160
// doesn't look like it, this test is specific to legacy context.
1161-
// @gate !disableLegacyContext
1161+
// @gate !disableLegacyContext && !disableLegacyContextForFunctionComponents
11621162
it('unwinds the context stack correctly on error', async () => {
11631163
class Provider extends React.Component {
11641164
static childContextTypes = {message: PropTypes.string};

Diff for: packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,18 @@ describe('ReactLazy', () => {
213213
unstable_isConcurrent: true,
214214
});
215215

216+
function App() {
217+
return (
218+
<Suspense fallback={<Text text="Loading..." />}>
219+
<LazyText text="Hi" />
220+
</Suspense>
221+
);
222+
}
223+
216224
let error;
217225
try {
218226
await act(() => {
219-
root.update(
220-
<Suspense fallback={<Text text="Loading..." />}>
221-
<LazyText text="Hi" />
222-
</Suspense>,
223-
);
227+
root.update(<App />);
224228
});
225229
} catch (e) {
226230
error = e;

Diff for: packages/react-reconciler/src/__tests__/ReactUse-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ describe('ReactUse', () => {
15621562
expect(root).toMatchRenderedOutput('Async!');
15631563
});
15641564

1565-
// @gate !disableLegacyContext
1565+
// @gate !disableLegacyContext && !disableLegacyContextForFunctionComponents
15661566
it('unwrap uncached promises in component that accesses legacy context', async () => {
15671567
class ContextProvider extends React.Component {
15681568
static childContextTypes = {

Diff for: packages/react-server/src/ReactFizzServer.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ import {
152152
import ReactSharedInternals from 'shared/ReactSharedInternals';
153153
import {
154154
disableLegacyContext,
155+
disableLegacyContextForFunctionComponents,
155156
enableScopeAPI,
156157
enableSuspenseAvoidThisFallbackFizz,
157158
enableCache,
@@ -1654,7 +1655,7 @@ function renderFunctionComponent(
16541655
props: any,
16551656
): void {
16561657
let legacyContext;
1657-
if (!disableLegacyContext) {
1658+
if (!disableLegacyContext && !disableLegacyContextForFunctionComponents) {
16581659
legacyContext = getMaskedContext(Component, task.legacyContext);
16591660
}
16601661
if (__DEV__) {

Diff for: packages/react/src/ReactOwnerStack.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ export function captureOwnerStack(): null | string {
2020
}
2121
// The current stack will be the owner stack if enableOwnerStacks is true
2222
// which it is always here. Otherwise it's the parent stack.
23-
return getCurrentStack(null);
23+
return getCurrentStack();
2424
}

0 commit comments

Comments
 (0)