@@ -70,7 +70,9 @@ class FlameGraphRenderer extends React.Component {
7070 this . rangeMin = 0 ;
7171 this . rangeMax = 1 ;
7272 this . query = '' ;
73- this . panelContainer = document . querySelector ( '.flamegraph-wrapper' ) ?. closest ( '.panel-wrapper' ) ;
73+ this . panelContainer =
74+ document . querySelector ( '.flamegraph-wrapper' ) ?. closest ( '.panel-container' ) ||
75+ document . querySelector ( '.flamegraph-wrapper' ) ?. closest ( '.panel-wrapper' ) ;
7476 window . addEventListener ( 'focus' , this . focusHandler ) ;
7577
7678 if ( this . props . shortcut ) {
@@ -81,13 +83,15 @@ class FlameGraphRenderer extends React.Component {
8183 }
8284
8385 componentDidUpdate ( prevProps , prevState ) {
84- if ( this . props . data . series && this . props . data . series . length ) {
85- const name = this . props . data . series [ this . props . data . series . length - 1 ] . name ;
86- const from = this . props . data ?. timeRange ?. raw . from . valueOf ( ) ;
87- const until = this . props . data ?. timeRange ?. raw . to . valueOf ( ) ;
88- const prevName = prevProps . data . series [ prevProps . data . series . length - 1 ] . name ;
89- const prevFrom = prevProps . data ?. timeRange ?. raw . from . valueOf ( ) ;
90- const prevUntil = prevProps . data ?. timeRange ?. raw . to . valueOf ( ) ;
86+ const prevData = prevProps . data ? prevProps . data : prevProps ;
87+ const currentData = this . props . data ? this . props . data : this . props ;
88+ if ( currentData . series && currentData . series . length ) {
89+ const name = currentData . series [ currentData . series . length - 1 ] . name ;
90+ const from = currentData ?. timeRange ?. raw . from . valueOf ( ) ;
91+ const until = currentData ?. timeRange ?. raw . to . valueOf ( ) ;
92+ const prevName = prevData . series [ prevData . series . length - 1 ] . name ;
93+ const prevFrom = prevData ?. timeRange ?. raw . from . valueOf ( ) ;
94+ const prevUntil = prevData ?. timeRange ?. raw . to . valueOf ( ) ;
9195 if ( from !== prevFrom || until !== prevUntil || name !== prevName ) {
9296 this . updateFlameBearerData ( ) ;
9397 }
0 commit comments