@@ -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' ;
9998import 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 } ,
0 commit comments