Skip to content

Commit d4e49b6

Browse files
committed
Add Profiler mode to fixtures even if React DevTools is not installed
1 parent 518d06d commit d4e49b6

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

fixtures/flight/src/index.js

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

@@ -54,14 +54,20 @@ async function hydrateApp() {
5454
}
5555
);
5656

57-
ReactDOM.hydrateRoot(document, <Shell data={root} />, {
58-
// TODO: This part doesn't actually work because the server only returns
59-
// form state during the request that submitted the form. Which means it
60-
// the state needs to be transported as part of the HTML stream. We intend
61-
// to add a feature to Fizz for this, but for now it's up to the
62-
// metaframework to implement correctly.
63-
formState: formState,
64-
});
57+
ReactDOM.hydrateRoot(
58+
document,
59+
<Profiler>
60+
<Shell data={root} />
61+
</Profiler>,
62+
{
63+
// TODO: This part doesn't actually work because the server only returns
64+
// form state during the request that submitted the form. Which means it
65+
// the state needs to be transported as part of the HTML stream. We intend
66+
// to add a feature to Fizz for this, but for now it's up to the
67+
// metaframework to implement correctly.
68+
formState: formState,
69+
}
70+
);
6571
}
6672

6773
// Remove this line to simulate MPA behavior

fixtures/ssr/src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import React from 'react';
2+
import {Profiler} from 'react';
23
import {hydrateRoot} from 'react-dom/client';
34

45
import App from './components/App';
56

6-
hydrateRoot(document, <App assets={window.assetManifest} />);
7+
hydrateRoot(
8+
document,
9+
<Profiler>
10+
<App assets={window.assetManifest} />
11+
</Profiler>
12+
);

0 commit comments

Comments
 (0)