@@ -62,43 +62,35 @@ interface ProfilerProps {
62
62
componentDisplayName ?: string ;
63
63
}
64
64
65
- interface ProfilerState {
66
- activity : number | null ;
67
- }
65
+ class Profiler extends React . Component < ProfilerProps > {
66
+ public activity : number | null ;
68
67
69
- class Profiler extends React . Component < ProfilerProps , ProfilerState > {
70
68
public constructor ( props : ProfilerProps ) {
71
69
super ( props ) ;
72
70
73
71
const { componentDisplayName = UNKNOWN_COMPONENT } = this . props ;
74
72
75
- this . state = {
76
- activity : getInitActivity ( componentDisplayName ) ,
77
- } ;
73
+ this . activity = getInitActivity ( componentDisplayName ) ;
78
74
}
79
75
80
76
public componentDidMount ( ) : void {
81
- if ( this . state . activity ) {
82
- afterNextFrame ( this . finishProfile ) ;
83
- }
77
+ afterNextFrame ( this . finishProfile ) ;
84
78
}
85
79
86
80
public componentWillUnmount ( ) : void {
87
- if ( this . state . activity ) {
88
- afterNextFrame ( this . finishProfile ) ;
89
- }
81
+ afterNextFrame ( this . finishProfile ) ;
90
82
}
91
83
92
84
public finishProfile = ( ) => {
93
- if ( ! this . state . activity ) {
85
+ if ( ! this . activity ) {
94
86
return ;
95
87
}
96
88
97
89
const tracingIntegration = getCurrentHub ( ) . getIntegration ( TRACING_GETTER ) ;
98
90
if ( tracingIntegration !== null ) {
99
91
// tslint:disable-next-line:no-unsafe-any
100
- ( tracingIntegration as any ) . constructor . popActivity ( this . state . activity ) ;
101
- this . setState ( { activity : null } ) ;
92
+ ( tracingIntegration as any ) . constructor . popActivity ( this . activity ) ;
93
+ this . activity = null ;
102
94
}
103
95
} ;
104
96
0 commit comments