@@ -62,43 +62,35 @@ interface ProfilerProps {
6262 componentDisplayName ?: string ;
6363}
6464
65- interface ProfilerState {
66- activity : number | null ;
67- }
65+ class Profiler extends React . Component < ProfilerProps > {
66+ public activity : number | null ;
6867
69- class Profiler extends React . Component < ProfilerProps , ProfilerState > {
7068 public constructor ( props : ProfilerProps ) {
7169 super ( props ) ;
7270
7371 const { componentDisplayName = UNKNOWN_COMPONENT } = this . props ;
7472
75- this . state = {
76- activity : getInitActivity ( componentDisplayName ) ,
77- } ;
73+ this . activity = getInitActivity ( componentDisplayName ) ;
7874 }
7975
8076 public componentDidMount ( ) : void {
81- if ( this . state . activity ) {
82- afterNextFrame ( this . finishProfile ) ;
83- }
77+ afterNextFrame ( this . finishProfile ) ;
8478 }
8579
8680 public componentWillUnmount ( ) : void {
87- if ( this . state . activity ) {
88- afterNextFrame ( this . finishProfile ) ;
89- }
81+ afterNextFrame ( this . finishProfile ) ;
9082 }
9183
9284 public finishProfile = ( ) => {
93- if ( ! this . state . activity ) {
85+ if ( ! this . activity ) {
9486 return ;
9587 }
9688
9789 const tracingIntegration = getCurrentHub ( ) . getIntegration ( TRACING_GETTER ) ;
9890 if ( tracingIntegration !== null ) {
9991 // 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 ;
10294 }
10395 } ;
10496
0 commit comments