Skip to content

Commit bc750cf

Browse files
authored
Short-circuit initialization of filtered-out tracks (#128)
Double-check in handling the initialization promise that a track is not filtered out before computing the initial data from onBoundsChanged(). Signed-off-by: Christian W. Damus <[email protected]>
1 parent 7155908 commit bc750cf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ui/src/controller/track_controller.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ export abstract class TrackController<
245245
promise
246246
.then(() => {
247247
this.isSetup = true;
248+
249+
// The host application may have filtered this track out
250+
if (!globals.state.tracks[this.trackId]) {
251+
return;
252+
}
253+
248254
let resolution = visibleState.resolution;
249255

250256
if (BigintMath.popcount(resolution) !== 1) {
@@ -257,7 +263,9 @@ export abstract class TrackController<
257263
resolution);
258264
})
259265
.then((data) => {
260-
this.publish(data);
266+
if (data) {
267+
this.publish(data);
268+
}
261269
})
262270
.finally(() => {
263271
this.requestingData = false;

0 commit comments

Comments
 (0)