Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c58a0b

Browse files
authored
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.
1 parent 9ee7964 commit 9c58a0b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

fixtures/flight/src/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import {Suspense} from 'react';
2+
import {use, Suspense} from 'react';
33
import ReactDOM from 'react-dom/client';
44
import {createFromFetch, encodeReply} from 'react-server-dom-webpack/client';
55

@@ -27,7 +27,8 @@ let data = createFromFetch(
2727
}
2828
);
2929

30-
// TODO: This transition shouldn't really be necessary but it is for now.
31-
React.startTransition(() => {
32-
ReactDOM.hydrateRoot(document, data);
33-
});
30+
function Shell({data}) {
31+
return use(data);
32+
}
33+
34+
ReactDOM.hydrateRoot(document, <Shell data={data} />);

0 commit comments

Comments
 (0)