Skip to content

Commit 7286add

Browse files
committed
Merge branch 'main' into rh/rm-ff-cache
# Conflicts: # packages/react-server/src/ReactFizzServer.js
2 parents dc5e75a + 2d32056 commit 7286add

38 files changed

+120
-1140
lines changed

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3080,7 +3080,7 @@ function pushTitle(
30803080
console.error(
30813081
'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length %s instead.' +
30823082
' Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value' +
3083-
' which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes.' +
3083+
' which is why Arrays of length greater than 1 are not supported. When using JSX it can be common to combine text nodes and value nodes.' +
30843084
' For example: <title>hello {nameOfUser}</title>. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop' +
30853085
' is using this form try rewriting it using a template string: <title>{`hello ${nameOfUser}`}</title>.',
30863086
children.length,
@@ -3886,18 +3886,6 @@ const clientRenderedSuspenseBoundaryError1D =
38863886
const clientRenderedSuspenseBoundaryError2 =
38873887
stringToPrecomputedChunk('></template>');
38883888

3889-
export function pushStartCompletedSuspenseBoundary(
3890-
target: Array<Chunk | PrecomputedChunk>,
3891-
) {
3892-
target.push(startCompletedSuspenseBoundary);
3893-
}
3894-
3895-
export function pushEndCompletedSuspenseBoundary(
3896-
target: Array<Chunk | PrecomputedChunk>,
3897-
) {
3898-
target.push(endSuspenseBoundary);
3899-
}
3900-
39013889
export function writeStartCompletedSuspenseBoundary(
39023890
destination: Destination,
39033891
renderState: RenderState,

packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ export {
142142
makeId,
143143
pushStartInstance,
144144
pushEndInstance,
145-
pushStartCompletedSuspenseBoundary,
146-
pushEndCompletedSuspenseBoundary,
147145
pushFormStateMarkerIsMatching,
148146
pushFormStateMarkerIsNotMatching,
149147
writeStartSegment,

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

Lines changed: 1 addition & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,151 +2211,6 @@ describe('ReactDOMFizzServer', () => {
22112211
expect(getVisibleChildren(container)).toEqual(<div>Hello</div>);
22122212
});
22132213

2214-
// @gate enableSuspenseAvoidThisFallbackFizz
2215-
it('should respect unstable_avoidThisFallback', async () => {
2216-
const resolved = {
2217-
0: false,
2218-
1: false,
2219-
};
2220-
const promiseRes = {};
2221-
const promises = {
2222-
0: new Promise(res => {
2223-
promiseRes[0] = () => {
2224-
resolved[0] = true;
2225-
res();
2226-
};
2227-
}),
2228-
1: new Promise(res => {
2229-
promiseRes[1] = () => {
2230-
resolved[1] = true;
2231-
res();
2232-
};
2233-
}),
2234-
};
2235-
2236-
const InnerComponent = ({isClient, depth}) => {
2237-
if (isClient) {
2238-
// Resuspend after re-rendering on client to check that fallback shows on client
2239-
throw new Promise(() => {});
2240-
}
2241-
if (!resolved[depth]) {
2242-
throw promises[depth];
2243-
}
2244-
return (
2245-
<div>
2246-
<Text text={`resolved ${depth}`} />
2247-
</div>
2248-
);
2249-
};
2250-
2251-
function App({isClient}) {
2252-
return (
2253-
<div>
2254-
<Text text="Non Suspense Content" />
2255-
<Suspense
2256-
fallback={
2257-
<span>
2258-
<Text text="Avoided Fallback" />
2259-
</span>
2260-
}
2261-
unstable_avoidThisFallback={true}>
2262-
<InnerComponent isClient={isClient} depth={0} />
2263-
<div>
2264-
<Suspense fallback={<Text text="Fallback" />}>
2265-
<Suspense
2266-
fallback={
2267-
<span>
2268-
<Text text="Avoided Fallback2" />
2269-
</span>
2270-
}
2271-
unstable_avoidThisFallback={true}>
2272-
<InnerComponent isClient={isClient} depth={1} />
2273-
</Suspense>
2274-
</Suspense>
2275-
</div>
2276-
</Suspense>
2277-
</div>
2278-
);
2279-
}
2280-
2281-
await jest.runAllTimers();
2282-
2283-
await act(() => {
2284-
const {pipe} = renderToPipeableStream(<App isClient={false} />);
2285-
pipe(writable);
2286-
});
2287-
2288-
// Nothing is output since root has a suspense with avoidedThisFallback that hasn't resolved
2289-
expect(getVisibleChildren(container)).toEqual(undefined);
2290-
expect(container.innerHTML).not.toContain('Avoided Fallback');
2291-
2292-
// resolve first suspense component with avoidThisFallback
2293-
await act(() => {
2294-
promiseRes[0]();
2295-
});
2296-
2297-
expect(getVisibleChildren(container)).toEqual(
2298-
<div>
2299-
Non Suspense Content
2300-
<div>resolved 0</div>
2301-
<div>Fallback</div>
2302-
</div>,
2303-
);
2304-
2305-
expect(container.innerHTML).not.toContain('Avoided Fallback2');
2306-
2307-
await act(() => {
2308-
promiseRes[1]();
2309-
});
2310-
2311-
expect(getVisibleChildren(container)).toEqual(
2312-
<div>
2313-
Non Suspense Content
2314-
<div>resolved 0</div>
2315-
<div>
2316-
<div>resolved 1</div>
2317-
</div>
2318-
</div>,
2319-
);
2320-
2321-
let root;
2322-
await act(async () => {
2323-
root = ReactDOMClient.hydrateRoot(container, <App isClient={false} />);
2324-
await waitForAll([]);
2325-
await jest.runAllTimers();
2326-
});
2327-
2328-
// No change after hydration
2329-
expect(getVisibleChildren(container)).toEqual(
2330-
<div>
2331-
Non Suspense Content
2332-
<div>resolved 0</div>
2333-
<div>
2334-
<div>resolved 1</div>
2335-
</div>
2336-
</div>,
2337-
);
2338-
2339-
await act(async () => {
2340-
// Trigger update by changing isClient to true
2341-
root.render(<App isClient={true} />);
2342-
await waitForAll([]);
2343-
await jest.runAllTimers();
2344-
});
2345-
2346-
// Now that we've resuspended at the root we show the root fallback
2347-
expect(getVisibleChildren(container)).toEqual(
2348-
<div>
2349-
Non Suspense Content
2350-
<div style="display: none;">resolved 0</div>
2351-
<div style="display: none;">
2352-
<div>resolved 1</div>
2353-
</div>
2354-
<span>Avoided Fallback</span>
2355-
</div>,
2356-
);
2357-
});
2358-
23592214
it('calls getServerSnapshot instead of getSnapshot', async () => {
23602215
const ref = React.createRef();
23612216

@@ -5928,7 +5783,7 @@ describe('ReactDOMFizzServer', () => {
59285783
pipe(writable);
59295784
});
59305785
}).toErrorDev([
5931-
'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length 2 instead. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes. For example: <title>hello {nameOfUser}</title>. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop is using this form try rewriting it using a template string: <title>{`hello ${nameOfUser}`}</title>.',
5786+
'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length 2 instead. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value which is why Arrays of length greater than 1 are not supported. When using JSX it can be common to combine text nodes and value nodes. For example: <title>hello {nameOfUser}</title>. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop is using this form try rewriting it using a template string: <title>{`hello ${nameOfUser}`}</title>.',
59325787
]);
59335788

59345789
expect(getVisibleChildren(document.head)).toEqual(<title />);

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

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -37,56 +37,6 @@ describe('ReactDOMServerIntegration', () => {
3737
resetModules();
3838
});
3939

40-
// Test pragmas don't support itRenders abstraction
41-
if (
42-
__EXPERIMENTAL__ &&
43-
require('shared/ReactFeatureFlags').enableDebugTracing
44-
) {
45-
describe('React.unstable_DebugTracingMode', () => {
46-
beforeEach(() => {
47-
spyOnDevAndProd(console, 'log');
48-
});
49-
50-
itRenders('with one child', async render => {
51-
const e = await render(
52-
<React.unstable_DebugTracingMode>
53-
<div>text1</div>
54-
</React.unstable_DebugTracingMode>,
55-
);
56-
const parent = e.parentNode;
57-
expect(parent.childNodes[0].tagName).toBe('DIV');
58-
});
59-
60-
itRenders('mode with several children', async render => {
61-
const Header = props => {
62-
return <p>header</p>;
63-
};
64-
const Footer = props => {
65-
return (
66-
<React.unstable_DebugTracingMode>
67-
<h2>footer</h2>
68-
<h3>about</h3>
69-
</React.unstable_DebugTracingMode>
70-
);
71-
};
72-
const e = await render(
73-
<React.unstable_DebugTracingMode>
74-
<div>text1</div>
75-
<span>text2</span>
76-
<Header />
77-
<Footer />
78-
</React.unstable_DebugTracingMode>,
79-
);
80-
const parent = e.parentNode;
81-
expect(parent.childNodes[0].tagName).toBe('DIV');
82-
expect(parent.childNodes[1].tagName).toBe('SPAN');
83-
expect(parent.childNodes[2].tagName).toBe('P');
84-
expect(parent.childNodes[3].tagName).toBe('H2');
85-
expect(parent.childNodes[4].tagName).toBe('H3');
86-
});
87-
});
88-
}
89-
9040
describe('React.StrictMode', () => {
9141
itRenders('a strict mode with one child', async render => {
9242
const e = await render(

packages/react-markup/src/ReactFizzConfigMarkup.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ export {
4949
getChildFormatContext,
5050
makeId,
5151
pushEndInstance,
52-
pushStartCompletedSuspenseBoundary,
53-
pushEndCompletedSuspenseBoundary,
5452
pushFormStateMarkerIsMatching,
5553
pushFormStateMarkerIsNotMatching,
5654
writeStartSegment,

0 commit comments

Comments
 (0)