Skip to content
Snippets Groups Projects
Commit adbd62af authored by Agate's avatar Agate :speech_balloon:
Browse files

Merge branch '1092-stuck-queue' into 'master'

Fix #1092: Ensure player doesn't disappear when last queue track is removed manually

See merge request !1122
parents 1c7bc176 b6a183f6
No related branches found
No related tags found
No related merge requests found
Ensure player doesn't disappear when last queue track is removed manually (#1092)
...@@ -104,8 +104,13 @@ export default { ...@@ -104,8 +104,13 @@ export default {
commit('splice', {start: index, size: 1}) commit('splice', {start: index, size: 1})
if (index < state.currentIndex) { if (index < state.currentIndex) {
commit('currentIndex', state.currentIndex - 1) commit('currentIndex', state.currentIndex - 1)
} } else if (index > 0 && index === state.tracks.length) {
if (current) { // kind of a edge case: if you delete the last track of the queue
// we set current index to the previous one to avoid the queue tab from
// being stuck because the player disappeared
// cf #1092
commit('currentIndex', state.tracks.length - 1)
} else if (current) {
// we play next track, which now have the same index // we play next track, which now have the same index
commit('currentIndex', index) commit('currentIndex', index)
} }
......
...@@ -133,7 +133,7 @@ describe('store/queue', () => { ...@@ -133,7 +133,7 @@ describe('store/queue', () => {
testAction({ testAction({
action: store.actions.cleanTrack, action: store.actions.cleanTrack,
payload: 3, payload: 3,
params: {state: {currentIndex: 2, tracks: []}}, params: {state: {currentIndex: 2, tracks: [1, 2, 3, 4, 5]}},
expectedMutations: [ expectedMutations: [
{ type: 'splice', payload: {start: 3, size: 1} } { type: 'splice', payload: {start: 3, size: 1} }
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment