···5252 if (inserting) return;
5353 inserting = true;
5454 const tracks = await loadTracks();
5555- // TODO: Webamp shouldn't stop playing the active track whenever the playlist changes.
5656- amp.setTracksToPlay([]);
5555+5656+ // TODO: This kinda messes up the UI,
5757+ // but at least the active audio doesn't stop playing.
5858+ amp.store.dispatch({ type: "REMOVE_ALL_TRACKS" });
5959+5760 // TODO: Webamp blows up if you add too much tracks
5861 amp.appendTracks(tracks.slice(0, 1000));
5959- amp.nextTrack();
6262+6363+ const status = amp.getMediaStatus();
6464+ if (status !== "PLAYING") amp.nextTrack();
6565+6066 inserting = false;
6167}
6268