Skip to content

Commit

Permalink
Avoid duplicate track reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Oct 17, 2020
1 parent 997aafa commit dce568f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/shared/store/network.ts
Expand Up @@ -240,6 +240,17 @@ const connectMixstatus = (network: ConnectedProlinkNetwork) => {
action(async state => {
const playedAt = new Date();

const latestHistory =
store.mixstatus.trackHistory[store.mixstatus.trackHistory.length - 1];

// TODO: The comparisons of track id are not sufficient here, since it's
// possible for two USBs to have a track collision.

// No need to report duplicate plays on tracks
if (state.trackId === latestHistory?.track.id) {
return;
}

await when(() => store.devices.get(state.deviceId)?.track?.id === state.trackId);

const device = store.devices.get(state.deviceId);
Expand Down

0 comments on commit dce568f

Please sign in to comment.