diff --git a/package.json b/package.json index 5334feda6e00de65fc2938e1c0d490e89d3dd95e..aa891d5bebea867a83e30dec8052df39b678edd1 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,6 @@ "react-tooltip": "3.8.0", "react-virtualized": "9.20.1", "redux": "3.7.2", - "redux-thunk": "2.0.1", "redux-mock-store": "^1.2.3", "redux-throttle": "0.1.1", "rimraf": "^2.6.1", diff --git a/src/lib/alerts/index.jsx b/src/lib/alerts/index.jsx index aec4134f2c7d42eb07cbb8a6ab770499142c51e1..9fb1800f8983c228dc2f772da3aa1ba4d01b2f97 100644 --- a/src/lib/alerts/index.jsx +++ b/src/lib/alerts/index.jsx @@ -20,7 +20,7 @@ const alerts = [ { alertId: 'createSuccess', alertType: AlertTypes.STANDARD, - clearList: ['createSuccess, creating, saveSuccess, saving'], + clearList: ['createSuccess', 'creating', 'saveSuccess', 'saving'], content: ( <FormattedMessage defaultMessage="Successfully created." @@ -35,7 +35,7 @@ const alerts = [ { alertId: 'creating', alertType: AlertTypes.STANDARD, - clearList: ['createSuccess, creating, saveSuccess, saving'], + clearList: ['createSuccess', 'creating', 'saveSuccess', 'saving'], content: ( <FormattedMessage defaultMessage="Creating..." @@ -71,7 +71,7 @@ const alerts = [ { alertId: 'saveSuccess', alertType: AlertTypes.INLINE, - clearList: ['createSuccess, creating, saveSuccess, saving'], + clearList: ['createSuccess', 'creating', 'saveSuccess', 'saving'], content: ( <FormattedMessage defaultMessage="Successfully saved." @@ -86,7 +86,7 @@ const alerts = [ { alertId: 'saving', alertType: AlertTypes.INLINE, - clearList: ['createSuccess, creating, saveSuccess, saving'], + clearList: ['createSuccess', 'creating', 'saveSuccess', 'saving'], content: ( <FormattedMessage defaultMessage="Saving..." diff --git a/src/lib/app-state-hoc.jsx b/src/lib/app-state-hoc.jsx index 4439d277b30ee24cad67f90a014288cc5951614d..9177c52192d4cb2126e34320826ccec19698eedf 100644 --- a/src/lib/app-state-hoc.jsx +++ b/src/lib/app-state-hoc.jsx @@ -1,8 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {Provider} from 'react-redux'; -import {applyMiddleware, createStore, combineReducers, compose} from 'redux'; -import thunk from 'redux-thunk'; +import {createStore, combineReducers, compose} from 'redux'; import ConnectedIntlProvider from './connected-intl-provider.jsx'; import localesReducer, {initLocale, localesInitialState} from '../reducers/locales'; @@ -46,9 +45,7 @@ const AppStateHOC = function (WrappedComponent, localesOnly) { // browser modal reducers = {locales: localesReducer}; initialState = {locales: initializedLocales}; - enhancer = composeEnhancers( - applyMiddleware(thunk) - ); + enhancer = composeEnhancers(); } else { // You are right, this is gross. But it's necessary to avoid // importing unneeded code that will crash unsupported browsers. @@ -88,10 +85,7 @@ const AppStateHOC = function (WrappedComponent, localesOnly) { locales: initializedLocales, scratchGui: initializedGui }; - enhancer = composeEnhancers( - guiMiddleware, - applyMiddleware(thunk) - ); + enhancer = composeEnhancers(guiMiddleware); } const reducer = combineReducers(reducers); this.store = createStore( diff --git a/src/lib/project-saver-hoc.jsx b/src/lib/project-saver-hoc.jsx index 9389d3c6d218143b9bf3bdccb9fd39c4d3d1f9dc..71787d661d75c181b0ddedf11db7ce5f2d7d5935 100644 --- a/src/lib/project-saver-hoc.jsx +++ b/src/lib/project-saver-hoc.jsx @@ -259,10 +259,10 @@ const ProjectSaverHOC = function (WrappedComponent) { onManualUpdateProject: () => dispatch(manualUpdateProject()), onProjectError: error => dispatch(projectError(error)), onShowAlert: alertType => dispatch(showStandardAlert(alertType)), - onShowCreateSuccessAlert: () => dispatch(showAlertWithTimeout('createSuccess')), - onShowCreatingAlert: () => dispatch(showAlertWithTimeout('creating')), - onShowSaveSuccessAlert: () => dispatch(showAlertWithTimeout('saveSuccess')), - onShowSavingAlert: () => dispatch(showAlertWithTimeout('saving')), + onShowCreateSuccessAlert: () => showAlertWithTimeout(dispatch, 'createSuccess'), + onShowCreatingAlert: () => showAlertWithTimeout(dispatch, 'creating'), + onShowSaveSuccessAlert: () => showAlertWithTimeout(dispatch, 'saveSuccess'), + onShowSavingAlert: () => showAlertWithTimeout(dispatch, 'saving'), onUpdatedProject: (projectId, loadingState) => dispatch(doneUpdatingProject(projectId, loadingState)) }); // Allow incoming props to override redux-provided props. Used to mock in tests. diff --git a/src/reducers/alerts.js b/src/reducers/alerts.js index 793c47d390501cf9b7c1c1ed72ea79d029fd72f1..75687d0ee039cca1a666adbcf24057d18d718c2b 100644 --- a/src/reducers/alerts.js +++ b/src/reducers/alerts.js @@ -34,7 +34,7 @@ const reducer = function (state, action) { const alertData = alertsData.find(thisAlertData => thisAlertData.alertId === alertId); if (alertData) { const newList = state.alertsList.filter(curAlert => ( - !alertData.clearList || alertData.clearList.indexOf(curAlert.alertId) + !alertData.clearList || alertData.clearList.indexOf(curAlert.alertId) === -1 )); if (action.data && action.data.message) { newAlert.message = action.data.message; @@ -160,10 +160,10 @@ const showExtensionAlert = function (data) { * Function to dispatch showing an alert, with optional * timeout to make it close/go away. * - * @param {object} alertId - the ID of the alert - * @return {null} - do not return a value + * @param {object} dispatch - dispatch function + * @param {string} alertId - the ID of the alert */ -const showAlertWithTimeout = alertId => (dispatch => { +const showAlertWithTimeout = function (dispatch, alertId) { const alertData = alertsData.find(thisAlertData => thisAlertData.alertId === alertId); if (alertData) { dispatch(showStandardAlert(alertId)); @@ -173,7 +173,7 @@ const showAlertWithTimeout = alertId => (dispatch => { }, alertData.maxDisplaySecs * 1000); } } -}); +}; export { reducer as default,