@@ -356,6 +356,8 @@ const SegmentTimelineContainerContent = withResolvedSegment(
356356
357357 componentWillUnmount ( ) : void {
358358 this . isUnmounted = true
359+ this . timelineDiv = null
360+ this . rundownCurrentPartInstanceId = null
359361 if ( this . intersectionObserver && this . state . isLiveSegment && this . props . followLiveSegments ) {
360362 if ( typeof this . props . onSegmentScroll === 'function' ) this . props . onSegmentScroll ( )
361363 }
@@ -380,6 +382,7 @@ const SegmentTimelineContainerContent = withResolvedSegment(
380382 RundownViewEventBus . off ( RundownViewEvents . REWIND_SEGMENTS , this . onRewindSegment )
381383 RundownViewEventBus . off ( RundownViewEvents . GO_TO_PART , this . onGoToPart )
382384 RundownViewEventBus . off ( RundownViewEvents . GO_TO_PART_INSTANCE , this . onGoToPartInstance )
385+ this . onWindowResize . cancel ( )
383386 window . removeEventListener ( 'resize' , this . onWindowResize )
384387 }
385388
@@ -396,6 +399,7 @@ const SegmentTimelineContainerContent = withResolvedSegment(
396399 } , 250 )
397400
398401 onTimeScaleChange = ( timeScaleVal : number ) => {
402+ if ( this . isUnmounted ) return
399403 if ( Number . isFinite ( timeScaleVal ) && timeScaleVal > 0 ) {
400404 this . setState ( ( state ) => ( {
401405 timeScale : timeScaleVal ,
@@ -405,6 +409,7 @@ const SegmentTimelineContainerContent = withResolvedSegment(
405409 }
406410
407411 onCollapseOutputToggle = ( outputLayer : IOutputLayerUi ) => {
412+ if ( this . isUnmounted ) return
408413 const collapsedOutputs = { ...this . state . collapsedOutputs }
409414 collapsedOutputs [ outputLayer . _id ] =
410415 outputLayer . isDefaultCollapsed && collapsedOutputs [ outputLayer . _id ] === undefined
@@ -419,6 +424,7 @@ const SegmentTimelineContainerContent = withResolvedSegment(
419424 }
420425 /** The user has scrolled scrollLeft seconds to the left in a child component */
421426 onScroll = ( scrollLeft : number ) => {
427+ if ( this . isUnmounted ) return
422428 this . setState ( {
423429 scrollLeft : Math . max (
424430 0 ,
@@ -434,6 +440,7 @@ const SegmentTimelineContainerContent = withResolvedSegment(
434440 }
435441
436442 onRewindSegment = ( ) => {
443+ if ( this . isUnmounted ) return
437444 if ( ! this . state . isLiveSegment ) {
438445 this . updateMaxTimeScale ( )
439446 . then ( ( ) => {
@@ -448,6 +455,7 @@ const SegmentTimelineContainerContent = withResolvedSegment(
448455 }
449456
450457 onGoToPartInner = ( part : PartUi , zoomInToFit ?: boolean ) => {
458+ if ( this . isUnmounted ) return
451459 this . setState ( ( state ) => {
452460 const timelineWidth = this . timelineDiv instanceof HTMLElement ? getElementWidth ( this . timelineDiv ) : 0 // unsure if this is good default/substitute
453461 let newScale : number | undefined
0 commit comments