@samitouri / QOS-React-2 / commits / 56a3c18e56

[Flight fixture] Remove redundant `use` (#26373)

Now that promises are renderable nodes, we can remove the `use` call from the root of the Flight fixture. Uncached promises will likely be accompanied by a warning when they are rendered outside a transition. But this promise is the result of a Flight response, so it's cached. And it's also a rendered as part of a transition. So it's fine. Indeed, this is the canonical way to use this feature.

Andrew Clark committed Mar 14, 2023 at 11:14 UTC 56a3c18e565959f04e3ef3bc93f70259b5b674c2
1 file changed +1 -6
fixtures/flight/src/index.js
+1 -6
@@ -27,12 +27,7 @@ let data = createFromFetch(
27 }
28 );
29
30 -// TODO: Once not needed once children can be promises.
31 -function Content() {
32 - return React.use(data);
33 -}
34 -
30 // TODO: This transition shouldn't really be necessary but it is for now.
31 React.startTransition(() => {
37 - ReactDOM.hydrateRoot(document, <Content />);
32 + ReactDOM.hydrateRoot(document, data);
33 });