Skip to content

Commit

Permalink
[Flight fixture] Remove redundant use (#26373)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
acdlite authored Mar 14, 2023
1 parent 6bd53a5 commit 56a3c18
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions fixtures/flight/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ let data = createFromFetch(
}
);

// TODO: Once not needed once children can be promises.
function Content() {
return React.use(data);
}

// TODO: This transition shouldn't really be necessary but it is for now.
React.startTransition(() => {
ReactDOM.hydrateRoot(document, <Content />);
ReactDOM.hydrateRoot(document, data);
});

0 comments on commit 56a3c18

Please sign in to comment.