diff --git a/src/bundles/analytics.js b/src/bundles/analytics.js index 72c8e8452..00bb51a1d 100644 --- a/src/bundles/analytics.js +++ b/src/bundles/analytics.js @@ -9,7 +9,8 @@ const ASYNC_ACTIONS_TO_RECORD = [ 'FILES_ADDBYPATH', 'FILES_MOVE', 'FILES_DELETE', - 'FILES_DOWNLOADLINK' + 'FILES_DOWNLOADLINK', + 'EXPERIMENTS_TOGGLE' ] const ASYNC_ACTION_RE = new RegExp(`^${ASYNC_ACTIONS_TO_RECORD.join('_|')}`) diff --git a/src/bundles/experiments.js b/src/bundles/experiments.js index e0a9f3679..dc2958919 100644 --- a/src/bundles/experiments.js +++ b/src/bundles/experiments.js @@ -1,9 +1,9 @@ import { createSelector } from 'redux-bundler' export const ACTIONS = { - EXP_TOGGLE: 'EXPERIMENTS_TOGGLE', - EXP_TOGGLE_SUCCESS: 'EXPERIMENTS_TOGGLE_SUCCESS', - EXP_TOGGLE_FAIL: 'EXPERIMENTS_TOGGLE_FAIL', + EXP_TOGGLE_STARTED: 'EXPERIMENTS_TOGGLE_STARTED', + EXP_TOGGLE_FINISH: 'EXPERIMENTS_TOGGLE_FINISH', + EXP_TOGGLE_FAILED: 'EXPERIMENTS_TOGGLE_FAILED', EXP_UPDATE_STATE: 'EXPERIMENTS_UPDATE_STATE' } @@ -73,13 +73,13 @@ export default { name: 'experiments', persistActions: [ - 'EXPERIMENTS_TOGGLE_SUCCESS', - 'EXPERIMENTS_TOGGLE_FAIL', - 'EXPERIMENTS_UPDATE_STATE' + ACTIONS.EXP_TOGGLE_FINISH, + ACTIONS.EXP_TOGGLE_FAILED, + ACTIONS.EXP_UPDATE_STATE ], reducer: (state = {}, action) => { - if (action.type === ACTIONS.EXP_TOGGLE) { + if (action.type === ACTIONS.EXP_TOGGLE_STARTED) { return block(state, action.payload.key) } @@ -87,11 +87,11 @@ export default { return mergeState(state, action.payload) } - if (action.type === ACTIONS.EXP_TOGGLE_SUCCESS) { + if (action.type === ACTIONS.EXP_TOGGLE_FINISH) { return toggleEnabled(state, action.payload.key) } - if (action.type === ACTIONS.EXP_TOGGLE_FAIL) { + if (action.type === ACTIONS.EXP_TOGGLE_FAILED) { return unblock(state, action.payload.key) } diff --git a/src/bundles/ipfs-desktop.js b/src/bundles/ipfs-desktop.js index 748f0fc8f..484a063d0 100644 --- a/src/bundles/ipfs-desktop.js +++ b/src/bundles/ipfs-desktop.js @@ -10,7 +10,7 @@ if (window.ipfsDesktop) { bundle = { ...bundle, reducer: (state = {}, action) => { - if (action.type === ACTIONS.EXP_TOGGLE) { + if (action.type === ACTIONS.EXP_TOGGLE_STARTED) { window.ipfsDesktop.toggleSetting(`experiments.${action.payload.key}`) } @@ -52,9 +52,9 @@ if (window.ipfsDesktop) { const key = changed.replace('experiments.', '') if (success) { - dispatch({ type: ACTIONS.EXP_TOGGLE_SUCCESS, payload: { key } }) + dispatch({ type: ACTIONS.EXP_TOGGLE_FINISH, payload: { key } }) } else { - dispatch({ type: ACTIONS.EXP_TOGGLE_FAIL, payload: { key } }) + dispatch({ type: ACTIONS.EXP_TOGGLE_FAILED, payload: { key } }) } } diff --git a/src/bundles/notify.js b/src/bundles/notify.js index 3041d06f6..6031bce45 100644 --- a/src/bundles/notify.js +++ b/src/bundles/notify.js @@ -1,4 +1,5 @@ import { createSelector } from 'redux-bundler' +import { ACTIONS as EXP_ACTIONS } from './experiments' /* # Notify @@ -59,7 +60,7 @@ const notify = { } } - if (action.type === 'EXPERIMENTS_TOGGLE_FAIL') { + if (action.type === EXP_ACTIONS.EXP_TOGGLE_FAILED) { return { ...state, show: true,