Skip to content

Commit

Permalink
Short-circuit initialization of filtered-out tracks (#128)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cdamus authored Nov 14, 2024
1 parent 7155908 commit bc750cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ui/src/controller/track_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ export abstract class TrackController<
promise
.then(() => {
this.isSetup = true;

// The host application may have filtered this track out
if (!globals.state.tracks[this.trackId]) {
return;
}

let resolution = visibleState.resolution;

if (BigintMath.popcount(resolution) !== 1) {
Expand All @@ -257,7 +263,9 @@ export abstract class TrackController<
resolution);
})
.then((data) => {
this.publish(data);
if (data) {
this.publish(data);
}
})
.finally(() => {
this.requestingData = false;
Expand Down

0 comments on commit bc750cf

Please sign in to comment.