Skip to content

Commit 0b98431

Browse files
committed
fix: add small delay to ensure nextPartInfo is ready prior to scroll
1 parent 746cec9 commit 0b98431

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

packages/webui/src/client/ui/RundownView.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,9 +1969,14 @@ const RundownViewContent = translateWithTracker<IPropsWithReady, IState, ITracke
19691969
this.props.playlist.nextPartInfo
19701970
) {
19711971
// scroll to next after activation
1972-
scrollToPartInstance(this.props.playlist.nextPartInfo.partInstanceId).catch((error) => {
1973-
if (!error.toString().match(/another scroll/)) console.warn(error)
1974-
})
1972+
// add small delay to ensure the nextPartInfo is available
1973+
setTimeout(() => {
1974+
if (this.props.playlist && this.props.playlist.nextPartInfo) {
1975+
scrollToPartInstance(this.props.playlist.nextPartInfo.partInstanceId).catch((error) => {
1976+
if (!error.toString().match(/another scroll/)) console.warn(error)
1977+
})
1978+
}
1979+
}, 120)
19751980
} else if (
19761981
// after take
19771982
this.props.playlist &&
@@ -2214,9 +2219,14 @@ const RundownViewContent = translateWithTracker<IPropsWithReady, IState, ITracke
22142219
this.setState({
22152220
followLiveSegments: true,
22162221
})
2217-
scrollToPartInstance(this.props.playlist.nextPartInfo.partInstanceId, true).catch((error) => {
2218-
if (!error.toString().match(/another scroll/)) console.warn(error)
2219-
})
2222+
// Small delay to ensure the nextPartInfo is available
2223+
setTimeout(() => {
2224+
if (this.props.playlist && this.props.playlist.nextPartInfo) {
2225+
scrollToPartInstance(this.props.playlist.nextPartInfo.partInstanceId, true).catch((error) => {
2226+
if (!error.toString().match(/another scroll/)) console.warn(error)
2227+
})
2228+
}
2229+
}, 120)
22202230
setTimeout(() => {
22212231
this.setState({
22222232
followLiveSegments: true,

0 commit comments

Comments
 (0)