Skip to content

[pull] main from facebook:main #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 51 additions & 90 deletions packages/react-devtools-shared/src/__tests__/preprocessData-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ describe('Timeline profiler', () => {
{
"batchUID": 0,
"depth": 0,
"duration": 0.014,
"duration": 0.012,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.008,
"type": "render-idle",
Expand All @@ -873,67 +873,51 @@ describe('Timeline profiler', () => {
{
"batchUID": 0,
"depth": 0,
"duration": 0.010,
"duration": 0.008,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.012,
"type": "commit",
},
{
"batchUID": 0,
"depth": 1,
"duration": 0.001,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.02,
"type": "layout-effects",
},
{
"batchUID": 0,
"depth": 0,
"duration": 0.004,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.023,
"timestamp": 0.021,
"type": "passive-effects",
},
],
1 => [
{
"batchUID": 1,
"depth": 0,
"duration": 0.014,
"duration": 0.012,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.028,
"timestamp": 0.026,
"type": "render-idle",
},
{
"batchUID": 1,
"depth": 0,
"duration": 0.003,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.028,
"timestamp": 0.026,
"type": "render",
},
{
"batchUID": 1,
"depth": 0,
"duration": 0.010,
"duration": 0.008,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.032,
"timestamp": 0.03,
"type": "commit",
},
{
"batchUID": 1,
"depth": 1,
"duration": 0.001,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.04,
"type": "layout-effects",
},
{
"batchUID": 1,
"depth": 0,
"duration": 0.003,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.043,
"timestamp": 0.039,
"type": "passive-effects",
},
],
Expand All @@ -949,26 +933,26 @@ describe('Timeline profiler', () => {
{
"componentName": "App",
"duration": 0.002,
"timestamp": 0.024,
"timestamp": 0.022,
"type": "passive-effect-mount",
"warning": null,
},
{
"componentName": "App",
"duration": 0.001,
"timestamp": 0.029,
"timestamp": 0.027,
"type": "render",
"warning": null,
},
{
"componentName": "App",
"duration": 0.001,
"timestamp": 0.044,
"timestamp": 0.04,
"type": "passive-effect-mount",
"warning": null,
},
],
"duration": 0.046,
"duration": 0.042,
"flamechart": [],
"internalModuleSourceToRanges": Map {
undefined => [
Expand Down Expand Up @@ -1031,7 +1015,7 @@ describe('Timeline profiler', () => {
{
"batchUID": 0,
"depth": 0,
"duration": 0.014,
"duration": 0.012,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.008,
"type": "render-idle",
Expand All @@ -1047,65 +1031,49 @@ describe('Timeline profiler', () => {
{
"batchUID": 0,
"depth": 0,
"duration": 0.010,
"duration": 0.008,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.012,
"type": "commit",
},
{
"batchUID": 0,
"depth": 1,
"duration": 0.001,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.02,
"type": "layout-effects",
},
{
"batchUID": 0,
"depth": 0,
"duration": 0.004,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.023,
"timestamp": 0.021,
"type": "passive-effects",
},
{
"batchUID": 1,
"depth": 0,
"duration": 0.014,
"duration": 0.012,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.028,
"timestamp": 0.026,
"type": "render-idle",
},
{
"batchUID": 1,
"depth": 0,
"duration": 0.003,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.028,
"timestamp": 0.026,
"type": "render",
},
{
"batchUID": 1,
"depth": 0,
"duration": 0.010,
"duration": 0.008,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.032,
"timestamp": 0.03,
"type": "commit",
},
{
"batchUID": 1,
"depth": 1,
"duration": 0.001,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.04,
"type": "layout-effects",
},
{
"batchUID": 1,
"depth": 0,
"duration": 0.003,
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.043,
"timestamp": 0.039,
"type": "passive-effects",
},
],
Expand Down Expand Up @@ -1149,7 +1117,7 @@ describe('Timeline profiler', () => {
{
"componentName": "App",
"lanes": "0b0000000000000000000000000000101",
"timestamp": 0.025,
"timestamp": 0.023,
"type": "schedule-state-update",
"warning": null,
},
Expand Down Expand Up @@ -1254,6 +1222,15 @@ describe('Timeline profiler', () => {
let promise = null;
let resolvedValue = null;
function readValue(value) {
if (React.use) {
if (promise === null) {
promise = Promise.resolve(true).then(() => {
return value;
});
promise.displayName = 'Testing displayName';
}
return React.use(promise);
}
if (resolvedValue !== null) {
return resolvedValue;
} else if (promise === null) {
Expand All @@ -1273,7 +1250,7 @@ describe('Timeline profiler', () => {
const testMarks = [creactCpuProfilerSample()];

const root = ReactDOMClient.createRoot(document.createElement('div'));
utils.act(() =>
await utils.actAsync(() =>
root.render(
<React.Suspense fallback="Loading...">
<Component />
Expand Down Expand Up @@ -1823,6 +1800,14 @@ describe('Timeline profiler', () => {
let promise = null;
let resolvedValue = null;
function readValue(value) {
if (React.use) {
if (promise === null) {
promise = Promise.resolve(true).then(() => {
return value;
});
}
return React.use(promise);
}
if (resolvedValue !== null) {
return resolvedValue;
} else if (promise === null) {
Expand Down Expand Up @@ -1881,6 +1866,14 @@ describe('Timeline profiler', () => {
let promise = null;
let resolvedValue = null;
function readValue(value) {
if (React.use) {
if (promise === null) {
promise = Promise.resolve(true).then(() => {
return value;
});
}
return React.use(promise);
}
if (resolvedValue !== null) {
return resolvedValue;
} else if (promise === null) {
Expand Down Expand Up @@ -2192,14 +2185,6 @@ describe('Timeline profiler', () => {
"timestamp": 10,
"type": "commit",
},
{
"batchUID": 1,
"depth": 1,
"duration": 0,
"lanes": "0b0000000000000000000000000100000",
"timestamp": 10,
"type": "layout-effects",
},
{
"batchUID": 1,
"depth": 0,
Expand Down Expand Up @@ -2234,14 +2219,6 @@ describe('Timeline profiler', () => {
"timestamp": 10,
"type": "commit",
},
{
"batchUID": 2,
"depth": 1,
"duration": 0,
"lanes": "0b0000000000000000000000000100000",
"timestamp": 10,
"type": "layout-effects",
},
{
"batchUID": 2,
"depth": 0,
Expand Down Expand Up @@ -2292,8 +2269,8 @@ describe('Timeline profiler', () => {
8 => "InputContinuous",
16 => "DefaultHydration",
32 => "Default",
64 => "TransitionHydration",
128 => "Transition",
64 => undefined,
128 => "TransitionHydration",
256 => "Transition",
512 => "Transition",
1024 => "Transition",
Expand Down Expand Up @@ -2349,14 +2326,6 @@ describe('Timeline profiler', () => {
"timestamp": 10,
"type": "commit",
},
{
"batchUID": 1,
"depth": 1,
"duration": 0,
"lanes": "0b0000000000000000000000000100000",
"timestamp": 10,
"type": "layout-effects",
},
{
"batchUID": 1,
"depth": 0,
Expand Down Expand Up @@ -2389,14 +2358,6 @@ describe('Timeline profiler', () => {
"timestamp": 10,
"type": "commit",
},
{
"batchUID": 2,
"depth": 1,
"duration": 0,
"lanes": "0b0000000000000000000000000100000",
"timestamp": 10,
"type": "layout-effects",
},
{
"batchUID": 2,
"depth": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ describe('ProfilerStore', () => {
it('should not throw while initializing context values for Fibers within a not-yet-mounted subtree', () => {
const promise = new Promise(resolve => {});
const SuspendingView = () => {
throw promise;
if (React.use) {
React.use(promise);
} else {
throw promise;
}
};

const App = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,14 @@ describe('ProfilingCache', () => {
it('should calculate durations correctly for suspended views', async () => {
let data;
const getData = () => {
if (React.use) {
if (!data) {
data = new Promise(resolve => {
resolve('abc');
});
}
return React.use(data);
}
if (data) {
return data;
} else {
Expand Down
Loading
Loading