From f9786d4b458fcb3eb66e55f0b055ada3b3411e5e Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sat, 3 Mar 2018 12:37:50 +0100
Subject: [PATCH] Remove batch refresh logic when not on batch detail

---
 front/src/components/library/import/BatchDetail.vue | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/front/src/components/library/import/BatchDetail.vue b/front/src/components/library/import/BatchDetail.vue
index 417fd55c2b..0864d2464a 100644
--- a/front/src/components/library/import/BatchDetail.vue
+++ b/front/src/components/library/import/BatchDetail.vue
@@ -62,12 +62,18 @@ export default {
   data () {
     return {
       isLoading: true,
-      batch: null
+      batch: null,
+      timeout: null
     }
   },
   created () {
     this.fetchData()
   },
+  destroyed () {
+    if (this.timeout) {
+      clearTimeout(this.timeout)
+    }
+  },
   methods: {
     fetchData () {
       var self = this
@@ -78,7 +84,7 @@ export default {
         self.batch = response.data
         self.isLoading = false
         if (self.batch.status === 'pending') {
-          setTimeout(
+          self.timeout = setTimeout(
             self.fetchData,
             5000
           )
-- 
GitLab