MCPcopy
hub / github.com/pburtchaell/redux-promise-middleware

github.com/pburtchaell/redux-promise-middleware @6.2.0 sqlite

repository ↗ · DeepWiki ↗ · release 6.2.0 ↗
48 symbols 126 edges 39 files 0 documented · 0%
README

Redux Promise Middleware

npm downloads

Redux Promise Middleware enables simple, yet robust handling of async action creators in Redux.

const asyncAction = () => ({
  type: 'PROMISE',
  payload: new Promise(...),
})

Given a single action with an async payload, the middleware transforms the action to a separate pending action and a separate fulfilled/rejected action, representing the states of the async action.

The middleware can be combined with Redux Thunk to chain action creators.

const secondAction = (data) => ({
  type: 'SECOND',
  payload: {...},
})

const firstAction = () => {
  return (dispatch) => {
    const response = dispatch({
      type: 'FIRST',
      payload: new Promise(...),
    })

    response.then((data) => {
      dispatch(secondAction(data))
    })
  }
}

Documentation and Help

Heads Up: Version 6 includes some breaking changes. Check the upgrading guide for help.

Issues

For bug reports and feature requests, file an issue on GitHub.

For help, ask a question on StackOverflow.

Releases

For older versions: - 5.x - 4.x - 3.x - 2.x - 1.x

Maintainers

Please reach out to us if you have any questions or comments.

Patrick Burtchaell (pburtchaell): - GitHub

Thomas Hudspith-Tatham (tomatau): - GitHub

License

Code licensed with the MIT License (MIT).

Documentation licensed with the CC BY-NC License.

Extension points exported contracts — how you extend this code

FluxStandardAction (Interface)
(no doc)
src/index.d.ts
State (Interface)
(no doc)
examples/using-typescript/store.ts
AsyncAction (Interface)
(no doc)
src/index.d.ts
Config (Interface)
(no doc)
src/index.d.ts

Core symbols most depended-on inside this repo

getActionCreator
called by 64
test/utils/defaults.js
createStore
called by 23
test/utils/createStore.js
isPromise
called by 4
src/isPromise.js
createPromise
called by 3
src/index.js
spyMiddleware
called by 2
test/utils/spyMiddleware.js
getAction
called by 2
src/index.js
render
called by 2
examples/using-promise-all/index.js
render
called by 2
examples/using-promise-actions/index.js

Shape

Function 38
Interface 4
Method 3
Class 2
Enum 1

Languages

TypeScript100%

Modules by API surface

src/index.js5 symbols
examples/catching-errors/index.js5 symbols
src/index.d.ts4 symbols
examples/using-promise-all/actions.js4 symbols
test/utils/defaults.js3 symbols
examples/using-typescript/index.ts3 symbols
examples/using-promise-middleware/index.js3 symbols
examples/using-typescript/store.ts2 symbols
examples/using-promise-all/index.js2 symbols
examples/using-promise-actions/index.js2 symbols
examples/catching-errors/actions.js2 symbols
examples/catching-errors-with-middleware/actions.js2 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@babel/cli7.7.0 · 1×
@babel/core7.7.4 · 1×
@babel/preset-env7.7.1 · 1×
@babel/preset-react7.7.0 · 1×
babel-eslint10.0.3 · 1×
babel-loader8.0.6 · 1×
bluebird3.5.0 · 1×
coveralls3.0.8 · 1×
eslint6.7.0 · 1×
eslint-config-airbnb18.0.1 · 1×
eslint-plugin-import2.18.2 · 1×

For agents

$ claude mcp add redux-promise-middleware \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact