From 0e153c0f4d973bb9e817a88eb8f623455b4ee781 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Mon, 23 Apr 2018 18:43:46 +0200
Subject: [PATCH] Fix #145: Radio will now append new track if you delete the
 last track in queue

---
 changes/changelog.d/145.bugfix | 1 +
 front/src/store/queue.js       | 3 +++
 2 files changed, 4 insertions(+)
 create mode 100644 changes/changelog.d/145.bugfix

diff --git a/changes/changelog.d/145.bugfix b/changes/changelog.d/145.bugfix
new file mode 100644
index 0000000000..5c66e5f8bd
--- /dev/null
+++ b/changes/changelog.d/145.bugfix
@@ -0,0 +1 @@
+Radio will now append new track if you delete the last track in queue (#145)
diff --git a/front/src/store/queue.js b/front/src/store/queue.js
index 2890dd1e8f..8d45dca008 100644
--- a/front/src/store/queue.js
+++ b/front/src/store/queue.js
@@ -100,6 +100,9 @@ export default {
         // we play next track, which now have the same index
         dispatch('currentIndex', index)
       }
+      if (state.currentIndex + 1 === state.tracks.length) {
+        dispatch('radios/populateQueue', null, {root: true})
+      }
     },
 
     resume ({state, dispatch, rootState}) {
-- 
GitLab