found source of double-render, removed old experiment
This commit is contained in:
parent
cccc1a5383
commit
8df400a676
|
@ -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 () => {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue