diff --git a/app/assets/javascripts/commit/pipelines/pipelines_store.js.es6 b/app/assets/javascripts/commit/pipelines/pipelines_store.js.es6
index 11a3449d99ae68c0b1194ea823ac813f53510b78..f1b41911b73d21a217d6aeb56366e8b8c89f15ec 100644
--- a/app/assets/javascripts/commit/pipelines/pipelines_store.js.es6
+++ b/app/assets/javascripts/commit/pipelines/pipelines_store.js.es6
@@ -26,7 +26,7 @@ class PipelinesStore {
    */
   startTimeAgoLoops() {
     const startTimeLoops = () => {
-      this.timeLoopInterval = setInterval(function timeloopInterval() {
+      this.timeLoopInterval = setInterval(() => {
         this.$children[0].$children.reduce((acc, component) => {
           const timeAgoComponent = component.$children.filter(el => el.$options._componentTag === 'time-ago')[0];
           acc.push(timeAgoComponent);
diff --git a/app/assets/javascripts/vue_realtime_listener/index.js.es6 b/app/assets/javascripts/vue_realtime_listener/index.js.es6
index 95564152cce71f31a36eb4864cc6f349ee307d08..30f6680a673cce5c631739a7cb6f72d1ca48646f 100644
--- a/app/assets/javascripts/vue_realtime_listener/index.js.es6
+++ b/app/assets/javascripts/vue_realtime_listener/index.js.es6
@@ -14,5 +14,16 @@
     window.addEventListener('focus', startIntervals);
     window.addEventListener('blur', removeIntervals);
     document.addEventListener('beforeunload', removeAll);
+
+    // add removeAll methods to stack
+    const stack = gl.VueRealtimeListener.reset;
+    gl.VueRealtimeListener.reset = () => {
+      gl.VueRealtimeListener.reset = stack;
+      removeAll();
+      stack();
+    };
   };
+
+  // remove all event listeners and intervals
+  gl.VueRealtimeListener.reset = () => undefined; // noop
 })(window.gl || (window.gl = {}));
diff --git a/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6 b/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6
index 559723bafcc51c63b1f0acfcc0d1090fcafa4ffc..789f5dc9f49e6188a408b1bd456f6b9b5ac425da 100644
--- a/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6
+++ b/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6
@@ -7,6 +7,9 @@ describe('Store', () => {
     store = new gl.commits.pipelines.PipelinesStore();
   });
 
+  // unregister intervals and event handlers
+  afterEach(() => gl.VueRealtimeListener.reset());
+
   it('should start with a blank state', () => {
     expect(store.state.pipelines.length).toBe(0);
   });