From 8df400a676dc5778b0e5401fde4c4bedfdafa9b9 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Mon, 25 Feb 2019 14:03:08 -0800 Subject: [PATCH] found source of double-render, removed old experiment --- app/controller.js | 13 ------------- app/experiments.js | 37 +------------------------------------ 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/app/controller.js b/app/controller.js index 9768e274..95fa9ad3 100644 --- a/app/controller.js +++ b/app/controller.js @@ -107,19 +107,7 @@ export default function(state, emitter) { render(); }); - /* - FIXME choo on Edge double-triggers loaded routes - causing 'authenticate' to fire twice which leads to - an error. Until that's fixed we have authLocked to - prevent the second event from causing the error. - Once choo doesn't double-trigger we can remove authLocked. - */ - let authLocked = false; emitter.on('authenticate', async (code, oauthState) => { - if (authLocked) { - return; - } - authLocked = true; try { await state.user.finishLogin(code, oauthState); await state.user.syncFileList(); @@ -128,7 +116,6 @@ export default function(state, emitter) { emitter.emit('replaceState', '/error'); setTimeout(render); } - authLocked = false; }); emitter.on('upload', async () => { diff --git a/app/experiments.js b/app/experiments.js index 90f3b521..28b4e851 100644 --- a/app/experiments.js +++ b/app/experiments.js @@ -1,41 +1,6 @@ import hash from 'string-hash'; -const experiments = { - S9wqVl2SQ4ab2yZtqDI3Dw: { - id: 'S9wqVl2SQ4ab2yZtqDI3Dw', - run: function(variant, state, emitter) { - switch (variant) { - case 1: - state.promo = 'blue'; - break; - case 2: - state.promo = 'pink'; - break; - default: - state.promo = 'grey'; - } - emitter.emit('render'); - }, - eligible: function() { - return ( - !/firefox|fxios/i.test(navigator.userAgent) && - document.querySelector('html').lang === 'en-US' - ); - }, - variant: function(state) { - const n = this.luckyNumber(state); - if (n < 0.33) { - return 0; - } - return n < 0.66 ? 1 : 2; - }, - luckyNumber: function(state) { - return luckyNumber( - `${this.id}:${state.storage.get('testpilot_ga__cid')}` - ); - } - } -}; +const experiments = {}; //Returns a number between 0 and 1 // eslint-disable-next-line no-unused-vars