Skip to content

Commit 9bd8867

Browse files
author
Brian Vaughn
committed
Removed interactions from DevTools Profiler UI
1 parent d2a67ab commit 9bd8867

24 files changed

+28
-1230
lines changed

packages/react-devtools-shared/src/__tests__/__snapshots__/profilingCache-test.js.snap

Lines changed: 0 additions & 383 deletions
Large diffs are not rendered by default.

packages/react-devtools-shared/src/__tests__/__snapshots__/profilingCharts-test.js.snap

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -255,48 +255,6 @@ Object {
255255
}
256256
`;
257257

258-
exports[`profiling charts interactions should contain valid data: Interactions 1`] = `
259-
Object {
260-
"interactions": Array [
261-
Object {
262-
"__count": 1,
263-
"id": 0,
264-
"name": "mount",
265-
"timestamp": 0,
266-
},
267-
Object {
268-
"__count": 0,
269-
"id": 1,
270-
"name": "update",
271-
"timestamp": 15,
272-
},
273-
],
274-
"lastInteractionTime": 25,
275-
"maxCommitDuration": 15,
276-
}
277-
`;
278-
279-
exports[`profiling charts interactions should contain valid data: Interactions 2`] = `
280-
Object {
281-
"interactions": Array [
282-
Object {
283-
"__count": 1,
284-
"id": 0,
285-
"name": "mount",
286-
"timestamp": 0,
287-
},
288-
Object {
289-
"__count": 0,
290-
"id": 1,
291-
"name": "update",
292-
"timestamp": 15,
293-
},
294-
],
295-
"lastInteractionTime": 25,
296-
"maxCommitDuration": 15,
297-
}
298-
`;
299-
300258
exports[`profiling charts ranked chart should contain valid data: 0: CommitTree 1`] = `
301259
Object {
302260
"nodes": Map {

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ import type {
9595
RendererInterface,
9696
WorkTagMap,
9797
} from './types';
98-
import type {Interaction} from 'react-devtools-shared/src/devtools/views/Profiler/types';
9998
import type {
10099
ComponentFilter,
101100
ElementType,
@@ -1730,24 +1729,22 @@ export function attach(
17301729
currentRootID = getFiberID(getPrimaryFiber(root.current));
17311730
setRootPseudoKey(currentRootID, root.current);
17321731

1733-
// Checking root.memoizedInteractions handles multi-renderer edge-case-
1734-
// where some v16 renderers support profiling and others don't.
1735-
if (isProfiling && root.memoizedInteractions != null) {
1736-
// If profiling is active, store commit time and duration, and the current interactions.
1737-
// The frontend may request this information after profiling has stopped.
1738-
currentCommitProfilingMetadata = {
1739-
changeDescriptions: recordChangeDescriptions ? new Map() : null,
1740-
durations: [],
1741-
commitTime: getCurrentTime() - profilingStartTime,
1742-
interactions: Array.from(root.memoizedInteractions).map(
1743-
(interaction: Interaction) => ({
1744-
...interaction,
1745-
timestamp: interaction.timestamp - profilingStartTime,
1746-
}),
1747-
),
1748-
maxActualDuration: 0,
1749-
priorityLevel: null,
1750-
};
1732+
if (isProfiling) {
1733+
// Handle multi-renderer edge-case where some v16 renderers support profiling and others don't.
1734+
if (
1735+
root.current != null &&
1736+
root.current.hasOwnProperty('treeBaseDuration')
1737+
) {
1738+
// If profiling is active, store commit time and duration.
1739+
// The frontend may request this information after profiling has stopped.
1740+
currentCommitProfilingMetadata = {
1741+
changeDescriptions: recordChangeDescriptions ? new Map() : null,
1742+
durations: [],
1743+
commitTime: getCurrentTime() - profilingStartTime,
1744+
maxActualDuration: 0,
1745+
priorityLevel: null,
1746+
};
1747+
}
17511748
}
17521749

17531750
mountFiberRecursively(root.current, null, false, false);
@@ -1780,23 +1777,17 @@ export function attach(
17801777
traceUpdatesForNodes.clear();
17811778
}
17821779

1783-
// Checking root.memoizedInteractions handles multi-renderer edge-case-
1784-
// where some v16 renderers support profiling and others don't.
1785-
const isProfilingSupported = root.memoizedInteractions != null;
1780+
// Handle multi-renderer edge-case where some v16 renderers support profiling and others don't.
1781+
const isProfilingSupported =
1782+
root.current != null && root.current.hasOwnProperty('treeBaseDuration');
17861783

17871784
if (isProfiling && isProfilingSupported) {
1788-
// If profiling is active, store commit time and duration, and the current interactions.
1785+
// If profiling is active, store commit time and duration.
17891786
// The frontend may request this information after profiling has stopped.
17901787
currentCommitProfilingMetadata = {
17911788
changeDescriptions: recordChangeDescriptions ? new Map() : null,
17921789
durations: [],
17931790
commitTime: getCurrentTime() - profilingStartTime,
1794-
interactions: Array.from(root.memoizedInteractions).map(
1795-
(interaction: Interaction) => ({
1796-
...interaction,
1797-
timestamp: interaction.timestamp - profilingStartTime,
1798-
}),
1799-
),
18001791
maxActualDuration: 0,
18011792
priorityLevel:
18021793
priorityLevel == null ? null : formatPriorityLevel(priorityLevel),
@@ -2889,7 +2880,6 @@ export function attach(
28892880
changeDescriptions: Map<number, ChangeDescription> | null,
28902881
commitTime: number,
28912882
durations: Array<number>,
2892-
interactions: Array<Interaction>,
28932883
maxActualDuration: number,
28942884
priorityLevel: string | null,
28952885
|};
@@ -2920,8 +2910,6 @@ export function attach(
29202910
(commitProfilingMetadata, rootID) => {
29212911
const commitData: Array<CommitDataBackend> = [];
29222912
const initialTreeBaseDurations: Array<[number, number]> = [];
2923-
const allInteractions: Map<number, Interaction> = new Map();
2924-
const interactionCommits: Map<number, Array<number>> = new Map();
29252913

29262914
const displayName =
29272915
(displayNamesByRootID !== null && displayNamesByRootID.get(rootID)) ||
@@ -2944,29 +2932,11 @@ export function attach(
29442932
const {
29452933
changeDescriptions,
29462934
durations,
2947-
interactions,
29482935
maxActualDuration,
29492936
priorityLevel,
29502937
commitTime,
29512938
} = commitProfilingData;
29522939

2953-
const interactionIDs: Array<number> = [];
2954-
2955-
interactions.forEach(interaction => {
2956-
if (!allInteractions.has(interaction.id)) {
2957-
allInteractions.set(interaction.id, interaction);
2958-
}
2959-
2960-
interactionIDs.push(interaction.id);
2961-
2962-
const commitIndices = interactionCommits.get(interaction.id);
2963-
if (commitIndices != null) {
2964-
commitIndices.push(commitIndex);
2965-
} else {
2966-
interactionCommits.set(interaction.id, [commitIndex]);
2967-
}
2968-
});
2969-
29702940
const fiberActualDurations: Array<[number, number]> = [];
29712941
const fiberSelfDurations: Array<[number, number]> = [];
29722942
for (let i = 0; i < durations.length; i += 3) {
@@ -2983,7 +2953,6 @@ export function attach(
29832953
duration: maxActualDuration,
29842954
fiberActualDurations,
29852955
fiberSelfDurations,
2986-
interactionIDs,
29872956
priorityLevel,
29882957
timestamp: commitTime,
29892958
});
@@ -2993,8 +2962,6 @@ export function attach(
29932962
commitData,
29942963
displayName,
29952964
initialTreeBaseDurations,
2996-
interactionCommits: Array.from(interactionCommits.entries()),
2997-
interactions: Array.from(allInteractions.entries()),
29982965
rootID,
29992966
});
30002967
},

packages/react-devtools-shared/src/backend/types.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type {
1414
ComponentFilter,
1515
ElementType,
1616
} from 'react-devtools-shared/src/types';
17-
import type {Interaction} from 'react-devtools-shared/src/devtools/views/Profiler/types';
1817
import type {ResolveNativeStyle} from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
1918

2019
type BundleType =
@@ -158,7 +157,6 @@ export type CommitDataBackend = {|
158157
fiberActualDurations: Array<[number, number]>,
159158
// Tuple of fiber ID and computed "self" duration
160159
fiberSelfDurations: Array<[number, number]>,
161-
interactionIDs: Array<number>,
162160
priorityLevel: string | null,
163161
timestamp: number,
164162
|};
@@ -168,9 +166,6 @@ export type ProfilingDataForRootBackend = {|
168166
displayName: string,
169167
// Tuple of Fiber ID and base duration
170168
initialTreeBaseDurations: Array<[number, number]>,
171-
// Tuple of Interaction ID and commit indices
172-
interactionCommits: Array<[number, Array<number>]>,
173-
interactions: Array<[number, Interaction]>,
174169
rootID: number,
175170
|};
176171

packages/react-devtools-shared/src/devtools/ProfilingCache.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,13 @@ import {
1616
getChartData as getFlamegraphChartData,
1717
invalidateChartData as invalidateFlamegraphChartData,
1818
} from 'react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder';
19-
import {
20-
getChartData as getInteractionsChartData,
21-
invalidateChartData as invalidateInteractionsChartData,
22-
} from 'react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder';
2319
import {
2420
getChartData as getRankedChartData,
2521
invalidateChartData as invalidateRankedChartData,
2622
} from 'react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder';
2723

2824
import type {CommitTree} from 'react-devtools-shared/src/devtools/views/Profiler/types';
2925
import type {ChartData as FlamegraphChartData} from 'react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder';
30-
import type {ChartData as InteractionsChartData} from 'react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder';
3126
import type {ChartData as RankedChartData} from 'react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder';
3227

3328
export default class ProfilingCache {
@@ -92,16 +87,6 @@ export default class ProfilingCache {
9287
rootID,
9388
});
9489

95-
getInteractionsChartData = ({
96-
rootID,
97-
}: {|
98-
rootID: number,
99-
|}): InteractionsChartData =>
100-
getInteractionsChartData({
101-
profilerStore: this._profilerStore,
102-
rootID,
103-
});
104-
10590
getRankedChartData = ({
10691
commitIndex,
10792
commitTree,
@@ -123,7 +108,6 @@ export default class ProfilingCache {
123108

124109
invalidateCommitTrees();
125110
invalidateFlamegraphChartData();
126-
invalidateInteractionsChartData();
127111
invalidateRankedChartData();
128112
}
129113
}

packages/react-devtools-shared/src/devtools/views/Icon.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export type IconType =
1717
| 'components'
1818
| 'copy'
1919
| 'flame-chart'
20-
| 'interactions'
2120
| 'profiler'
2221
| 'ranked-chart'
2322
| 'search'
@@ -50,9 +49,6 @@ export default function Icon({className = '', type}: Props) {
5049
case 'flame-chart':
5150
pathData = PATH_FLAME_CHART;
5251
break;
53-
case 'interactions':
54-
pathData = PATH_INTERACTIONS;
55-
break;
5652
case 'profiler':
5753
pathData = PATH_PROFILER;
5854
break;
@@ -120,14 +116,6 @@ const PATH_FLAME_CHART = `
120116
13.3541667,19.4702042 C13.3541667,20.1226027 12.7851952,20.6514763 12.0833333,20.6514763 Z
121117
`;
122118

123-
const PATH_INTERACTIONS = `
124-
M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2
125-
2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55
126-
4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02
127-
9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55
128-
2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2z
129-
`;
130-
131119
const PATH_PROFILER = 'M5 9.2h3V19H5zM10.6 5h2.8v14h-2.8zm5.6 8H19v6h-2.8z';
132120

133121
const PATH_SEARCH = `

packages/react-devtools-shared/src/devtools/views/Profiler/InteractionListItem.css

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)