upgrade redux-thunk

flag=none

closes CFA-30

Change-Id: Ibdca0a4d89e2b82859dfc551227bbfe53bad0131
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/335971
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Hulse <michael.hulse@instructure.com>
Reviewed-by: Jackson Huang <jackson.huang@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
This commit is contained in:
Aaron Shafovaloff 2023-12-26 07:07:15 -05:00
parent 90165bf122
commit e02388380c
26 changed files with 54 additions and 54 deletions

View File

@ -188,7 +188,7 @@
"redux-actions": "^2.6.4",
"redux-promise": "^0.6",
"redux-saga": "^0.16.0",
"redux-thunk": "^2.3.0",
"redux-thunk": "^3.1.0",
"reselect": "^4.0.0",
"shallow-equal": "^1.2.0",
"spin.js": "2.3.2",

View File

@ -161,7 +161,7 @@
"react-transition-group": "^1",
"redux": "^4",
"redux-batch-middleware": "^0.2.0",
"redux-thunk": "^2",
"redux-thunk": "^3.1.0",
"text-field-edit": "^3.2.0",
"tinymce": "^5",
"uri-js": "^4.2.2",

View File

@ -19,14 +19,14 @@
import {createStore, applyMiddleware} from 'redux'
import rootReducer from '../reducers'
import initialState from './initialState'
import thunkMiddleware from 'redux-thunk'
import {thunk} from 'redux-thunk'
import {batch, batching} from 'redux-batch-middleware'
export default function (props, state) {
const store = createStore(
batching(rootReducer),
state || initialState(props),
applyMiddleware(thunkMiddleware, batch)
applyMiddleware(thunk, batch)
)
return store

View File

@ -17,7 +17,7 @@
*/
import {createStore, applyMiddleware} from 'redux'
import thunkMiddleware from 'redux-thunk'
import {thunk} from 'redux-thunk'
import {batch, batching} from 'redux-batch-middleware'
import sinon from 'sinon'
@ -39,7 +39,7 @@ export function spiedReducer() {
// the reducer is also hung off the returned store
export function spiedStore(state) {
const reducer = spiedReducer()
const store = createStore(batching(reducer), state, applyMiddleware(thunkMiddleware, batch))
const store = createStore(batching(reducer), state, applyMiddleware(thunk, batch))
store.spy = reducer.spy
return store
}

View File

@ -17,9 +17,9 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from '@canvas/blueprint-courses/react/reducer'
export default function mockStore(initialState) {
return applyMiddleware(ReduxThunk)(createStore)(rootReducer, initialState)
return applyMiddleware(thunk)(createStore)(rootReducer, initialState)
}

View File

@ -17,10 +17,10 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from '../reducers/rootReducer'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk)(createStore)
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)
function configureStore(initialState) {
return createStoreWithMiddleware(rootReducer, initialState)

View File

@ -17,7 +17,7 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {withExtraArgument} from 'redux-thunk'
import rootReducer from './reducers'
export const defaultState = {
@ -35,7 +35,7 @@ export const defaultState = {
export function configStore(initialState, api, options = {}) {
const middleware = [
ReduxThunk.withExtraArgument({axios: api}),
withExtraArgument({axios: api}),
process.env.NODE_ENV !== 'production' &&
process.env.NODE_ENV !== 'test' &&
!options.disableLogger &&

View File

@ -17,12 +17,12 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from './reducer'
export default function configStore(initialState) {
const middleware = [
ReduxThunk,
thunk,
// this is so redux-logger is not included in the production webpack bundle
process.env.NODE_ENV !== 'production' &&

View File

@ -17,14 +17,14 @@
*/
import {applyMiddleware, createStore} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import buildAssignmentReducer from './assignment/buildAssignmentReducer'
import gradesReducer from './grades/gradesReducer'
import studentsReducer from './students/studentsReducer'
import {composeReducers} from './ReducerHelpers'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk)(createStore)
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)
export default function configureStore(env) {
const reducers = [buildAssignmentReducer(env), gradesReducer, studentsReducer]

View File

@ -17,10 +17,10 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from '../reducers/indexMenuReducer'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk)(createStore)
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)
function configureStore(initialState) {
return createStoreWithMiddleware(rootReducer, initialState)

View File

@ -17,7 +17,7 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import reducer from '../reducer'
import initialState from './initialState'
@ -28,7 +28,7 @@ const middleware = [
process.env.NODE_ENV !== 'test' &&
require('redux-logger').logger,
ReduxThunk,
thunk,
].filter(Boolean)
const createStoreWithMiddleware = applyMiddleware(...middleware)(createStore)

View File

@ -17,10 +17,10 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from './reducer'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk)(createStore)
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)
function configStore(initialState) {
return createStoreWithMiddleware(rootReducer, initialState)

View File

@ -21,7 +21,7 @@ import React from 'react'
import {render} from '@testing-library/react'
import {createStore, applyMiddleware} from 'redux'
import {Provider} from 'react-redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import {DEFAULT_STORE_STATE} from './fixtures'
import {StoreState} from '../types'
@ -34,4 +34,4 @@ export const renderConnected = (
// We need to use a middleware to mock async actions
const withMiddleware = (rootReducer, initialState) =>
applyMiddleware(ReduxThunk)(createStore)(rootReducer, initialState)
applyMiddleware(thunk)(createStore)(rootReducer, initialState)

View File

@ -18,11 +18,11 @@
import {createStore, applyMiddleware} from 'redux'
import {composeWithDevTools} from 'redux-devtools-extension/developmentOnly'
import thunkMiddleware from 'redux-thunk'
import {thunk} from 'redux-thunk'
import defaultReducers from '../reducers/reducers'
export default (reducers = defaultReducers) => {
const middlewares: any[] = [thunkMiddleware]
const middlewares: any[] = [thunk]
if (process.env.NODE_ENV === `development`) {
const {createLogger} = require(`redux-logger`) // tslint:disable-line

View File

@ -17,10 +17,10 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from '../reducer'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk)(createStore)
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)
function configureStore(initialState) {
return createStoreWithMiddleware(rootReducer, initialState)

View File

@ -17,7 +17,7 @@
*/
import {createStore, applyMiddleware, combineReducers} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import _ from 'lodash'
import listDeveloperKeysReducer from '../reducers/listDeveloperKeysReducer'
import deactivateDeveloperKeyReducer from '../reducers/deactivateReducer'
@ -29,7 +29,7 @@ import makeInvisibleDeveloperKeyReducer from '../reducers/makeInvisibleReducer'
import listDeveloperKeyScopesReducer from '../reducers/listScopesReducer'
const middleware = [
ReduxThunk,
thunk,
// this is so redux-logger is not included in the production webpack bundle
process.env.NODE_ENV !== 'production' &&

View File

@ -17,12 +17,12 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from './rootReducer'
export default function configStore(initialState) {
const middleware = [
ReduxThunk,
thunk,
// this is so redux-logger is not included in the production webpack bundle
process.env.NODE_ENV !== 'production' &&

View File

@ -17,9 +17,9 @@
*/
import {createStore, applyMiddleware} from 'redux'
import thunkMiddleware from 'redux-thunk'
import {thunk} from 'redux-thunk'
import gradebookHistory from '../reducers/Reducer'
const GradebookHistoryStore = createStore(gradebookHistory, applyMiddleware(thunkMiddleware))
const GradebookHistoryStore = createStore(gradebookHistory, applyMiddleware(thunk))
export default GradebookHistoryStore

View File

@ -17,14 +17,14 @@
*/
import {createStore, applyMiddleware, combineReducers} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import ltiCollaboratorsReducer from './reducers/ltiCollaboratorsReducer'
import listCollaborationsReducer from './reducers/listCollaborationsReducer'
import deleteCollaborationReducer from './reducers/deleteCollaborationReducer'
import createCollaborationReducer from './reducers/createCollaborationReducer'
import updateCollaborationReducer from './reducers/updateCollaborationReducer'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk)(createStore)
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)
const collaboratorationsReducer = combineReducers({
ltiCollaborators: ltiCollaboratorsReducer,

View File

@ -17,13 +17,13 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from './reducer'
export default function configStore(initialState) {
// TODO: Make this comprehensible
const middleware = [
ReduxThunk,
thunk,
process.env.NODE_ENV !== 'production' &&
process.env.NODE_ENV !== 'test' &&
require('redux-logger').logger,

View File

@ -17,10 +17,10 @@
*/
import {applyMiddleware, createStore as reduxCreateStore} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
// returns createStore(reducer, initialState)
export const createStore = applyMiddleware(ReduxThunk)(reduxCreateStore)
export const createStore = applyMiddleware(thunk)(reduxCreateStore)
export const defaultState = {
courseParams: {

View File

@ -17,12 +17,12 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from './reducer'
export default function configStore(initialState) {
const middleware = [
ReduxThunk,
thunk,
// this is so redux-logger is not included in the production webpack bundle
process.env.NODE_ENV !== 'production' &&

View File

@ -17,11 +17,11 @@
*/
import {applyMiddleware, createStore} from 'redux'
import thunker from 'redux-thunk'
import {thunk} from 'redux-thunk'
import promiser from 'redux-promise'
import {createLogger} from 'redux-logger'
export const middleware = [thunker, promiser]
export const middleware = [thunk, promiser]
export default function createReduxStore(reducer) {
const middlewareWithLogger = [...middleware, createLogger({stateTransformer: s => s.toJS()})]

View File

@ -17,10 +17,10 @@
*/
import {createStore, applyMiddleware} from 'redux'
import ReduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import rootReducer from './reducers/root-reducer'
const createStoreWithMiddleware = applyMiddleware(ReduxThunk)(createStore)
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)
function configureStore(initialState) {
return createStoreWithMiddleware(rootReducer, initialState)

View File

@ -16,7 +16,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {createStore, applyMiddleware} from 'redux'
import reduxThunk from 'redux-thunk'
import {thunk} from 'redux-thunk'
import reduxPromise from 'redux-promise'
import createSagaMiddleware from 'redux-saga'
import {composeWithDevTools} from 'redux-devtools-extension/developmentOnly'
@ -26,12 +26,7 @@ import allSagas from '../actions/sagas'
export default function configureStore(uiManager, defaultState) {
const sagaMiddleware = createSagaMiddleware()
const middlewares = [
reduxThunk,
reduxPromise,
sagaMiddleware,
createDynamicUiMiddleware(uiManager),
]
const middlewares = [thunk, reduxPromise, sagaMiddleware, createDynamicUiMiddleware(uiManager)]
const store = createStore(
rootReducer,

View File

@ -23214,11 +23214,16 @@ redux-saga@^0.16.0:
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.16.2.tgz#993662e86bc945d8509ac2b8daba3a8c615cc971"
integrity sha512-iIjKnRThI5sKPEASpUvySemjzwqwI13e3qP7oLub+FycCRDysLSAOwt958niZW6LhxfmS6Qm1BzbU70w/Koc4w==
redux-thunk@^2, redux-thunk@^2.1.0, redux-thunk@^2.2.0, redux-thunk@^2.3.0:
redux-thunk@^2.1.0, redux-thunk@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622"
integrity sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw==
redux-thunk@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-3.1.0.tgz#94aa6e04977c30e14e892eae84978c1af6058ff3"
integrity sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==
redux@^3.6.0, redux@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b"