+ Loading A
+ {/* // TODO: This is incorrect. It should be "Loading B" but Fizz SuspenseList
+ // isn't implemented fully yet. */}
+ B
+
,
+ );
// Add more rows before we've hydrated the first two.
root.render(
+ Loading A
+ {/* // TODO: This is incorrect. It should be "Loading B" but Fizz SuspenseList
+ // isn't implemented fully yet. */}
+ B
+ Loading C
+
,
+ );
await act(async () => {
await resolveText('A');
@@ -1337,11 +1343,13 @@ describe('ReactDOMFizzServer', () => {
await waitForAll([]);
- expect(getVisibleChildren(container)).toEqual([
- Loading A...
,
- Loading B...
,
+ Loading A...
,
+ Loading root...
);
expect(loggedErrors).toEqual([]);
@@ -2145,7 +2175,7 @@ describe('ReactDOMFizzServer', () => {
// We still can't render it on the client because we haven't unblocked the parent.
await waitForAll([]);
- expect(getVisibleChildren(container)).toEqual('Loading root...');
+ expect(getVisibleChildren(container)).toEqual(Loading root...
);
// Unblock the loading state
await act(() => {
@@ -2153,7 +2183,11 @@ describe('ReactDOMFizzServer', () => {
});
// Now we're able to show the inner boundary.
- expect(getVisibleChildren(container)).toEqual(Loading...
);
+ expect(getVisibleChildren(container)).toEqual(
+
- hello
world, {'Foo'}!
+
+
+ helloworld, {'Foo'}!
+
,
);
});
@@ -5348,12 +5387,14 @@ describe('ReactDOMFizzServer', () => {
it('works with multiple adjacent segments', async () => {
function App() {
return (
-
-
-
+
);
}
@@ -5377,7 +5418,7 @@ describe('ReactDOMFizzServer', () => {
stripExternalRuntimeInNodes(
container.children,
renderOptions.unstable_externalRuntimeSrc,
- )[0].outerHTML,
+ )[0].children[0].outerHTML,
).toEqual('
helloworld
');
const errors = [];
@@ -5389,19 +5430,23 @@ describe('ReactDOMFizzServer', () => {
await waitForAll([]);
expect(errors).toEqual([]);
expect(getVisibleChildren(container)).toEqual(
-
{['h', 'ello', 'w', 'orld']}
,
+
+
{['h', 'ello', 'w', 'orld']}
+
,
);
});
it('works when some segments are flushed and others are patched', async () => {
function App() {
return (
-
-
-
+
);
}
@@ -5422,7 +5467,7 @@ describe('ReactDOMFizzServer', () => {
stripExternalRuntimeInNodes(
container.children,
renderOptions.unstable_externalRuntimeSrc,
- )[0].outerHTML,
+ )[0].children[0].outerHTML,
).toEqual('
helloworld
');
const errors = [];
@@ -5437,7 +5482,9 @@ describe('ReactDOMFizzServer', () => {
await waitForAll([]);
expect(errors).toEqual([]);
expect(getVisibleChildren(container)).toEqual(
-
{['h', 'ello', 'w', 'orld']}
,
+
+
{['h', 'ello', 'w', 'orld']}
+
,
);
});
@@ -6073,11 +6120,13 @@ describe('ReactDOMFizzServer', () => {
function App() {
return (
-
-
-
-
-
+
);
}
@@ -6107,7 +6156,7 @@ describe('ReactDOMFizzServer', () => {
await promiseC;
});
- expect(getVisibleChildren(container)).toEqual('Loading...');
+ expect(getVisibleChildren(container)).toEqual(
Loading...
);
expect(reportedServerErrors.length).toBe(1);
expect(reportedServerErrors[0].message).toBe('Oops!');
@@ -6122,7 +6171,7 @@ describe('ReactDOMFizzServer', () => {
},
});
await waitForAll([]);
- expect(getVisibleChildren(container)).toEqual('Oops!');
+ expect(getVisibleChildren(container)).toEqual(
Oops!
);
// Because this is rethrown on the client, it is not a recoverable error.
expect(reportedClientErrors.length).toBe(0);
// It is caught by the error boundary.
@@ -8792,4 +8841,904 @@ describe('ReactDOMFizzServer', () => {
),
]);
});
+
+ it('can suspend inside the
tag', async () => {
+ function BlockedOn({value, children}) {
+ readText(value);
+ return children;
+ }
+
+ function App() {
+ return (
+
+
+