@@ -149,6 +149,8 @@ const SegmentTimelineContainerContent = withResolvedSegment(
149149 intersectionObserver : IntersectionObserver | undefined
150150 mountedTime = 0
151151 nextPartOffset = 0
152+ liveLineRefreshFrame : number | undefined
153+ pendingLiveLineRefreshEvent : TimingEvent | undefined
152154
153155 constructor ( props : IProps & ITrackedResolvedSegmentProps ) {
154156 super ( props )
@@ -354,6 +356,11 @@ const SegmentTimelineContainerContent = withResolvedSegment(
354356 }
355357
356358 this . stopLive ( )
359+ if ( this . liveLineRefreshFrame !== undefined ) {
360+ window . cancelAnimationFrame ( this . liveLineRefreshFrame )
361+ this . liveLineRefreshFrame = undefined
362+ this . pendingLiveLineRefreshEvent = undefined
363+ }
357364 RundownViewEventBus . off ( RundownViewEvents . REWIND_SEGMENTS , this . onRewindSegment )
358365 RundownViewEventBus . off ( RundownViewEvents . GO_TO_PART , this . onGoToPart )
359366 RundownViewEventBus . off ( RundownViewEvents . GO_TO_PART_INSTANCE , this . onGoToPartInstance )
@@ -491,7 +498,14 @@ const SegmentTimelineContainerContent = withResolvedSegment(
491498 }
492499 }
493500
494- onAirLineRefresh = ( e : TimingEvent ) => {
501+ private flushAirLineRefresh = ( ) => {
502+ this . liveLineRefreshFrame = undefined
503+ const event = this . pendingLiveLineRefreshEvent
504+ this . pendingLiveLineRefreshEvent = undefined
505+ if ( event ) this . applyAirLineRefresh ( event )
506+ }
507+
508+ private applyAirLineRefresh = ( e : TimingEvent ) => {
495509 this . setState ( ( state ) => {
496510 if ( state . isLiveSegment && state . currentLivePart ) {
497511 const currentLivePartInstance = state . currentLivePart . instance
@@ -534,6 +548,12 @@ const SegmentTimelineContainerContent = withResolvedSegment(
534548 } )
535549 }
536550
551+ onAirLineRefresh = ( e : TimingEvent ) => {
552+ this . pendingLiveLineRefreshEvent = e
553+ if ( this . liveLineRefreshFrame !== undefined ) return
554+ this . liveLineRefreshFrame = window . requestAnimationFrame ( this . flushAirLineRefresh )
555+ }
556+
537557 visibleChanged = ( entries : IntersectionObserverEntry [ ] ) => {
538558 // Add a small debounce to ensure UI has settled before checking
539559 if ( this . visibilityChangeTimeout ) {
0 commit comments