Update Flight fixture to use use() instead of Promise as a child (#26715)

The Promise as a child case seems buggy. It ends up throwing the Promise
as fatal when used in Sync rendering.
This commit is contained in:
Sebastian Markbåge 2023-04-24 14:00:25 -04:00 committed by GitHub
parent 9ee7964302
commit 9c58a0b647
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import * as React from 'react';
import {Suspense} from 'react';
import {use, Suspense} from 'react';
import ReactDOM from 'react-dom/client';
import {createFromFetch, encodeReply} from 'react-server-dom-webpack/client';
@ -27,7 +27,8 @@ let data = createFromFetch(
}
);
// TODO: This transition shouldn't really be necessary but it is for now.
React.startTransition(() => {
ReactDOM.hydrateRoot(document, data);
});
function Shell({data}) {
return use(data);
}
ReactDOM.hydrateRoot(document, <Shell data={data} />);