{"id":18726,"library":"redux-listener-middleware","title":"redux-listener-middleware","description":"A Redux middleware that listens for and reacts on Flux actions, allowing side-effects and async operations without thunks. Current stable version is 0.2.0, with a small set of releases. It differentiates itself by using rule-based filtering (regex or function) and action transformation before listener invocation, providing a centralized way to handle async flows while keeping reducers pure. Unlike redux-thunk, actions remain plain objects, and listeners are decoupled from action creators. Active development appears to have stalled.","status":"maintenance","version":"0.2.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/matthias-reis/redux-interceptor-middleware","tags":["javascript"],"install":[{"cmd":"npm install redux-listener-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add redux-listener-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add redux-listener-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; middleware requires Redux store.","package":"redux","optional":false}],"imports":[{"note":"Default export is a factory function, not a named export.","wrong":"const { listen } = require('redux-listener-middleware')","symbol":"listen","correct":"import listen from 'redux-listener-middleware'"},{"note":"listen() returns a middleware instance; it is not a constructor.","wrong":"new listen()","symbol":"MiddlewareInstance","correct":"const middleware = listen()"},{"note":"createListener is a method on the returned instance, not static.","wrong":"listen().createListener(...)","symbol":"createListener","correct":"middleware.createListener((action, dispatch) => { ... })"}],"quickstart":{"code":"import { createStore, applyMiddleware } from 'redux';\nimport listen from 'redux-listener-middleware';\n\nconst middleware = listen();\n\nmiddleware.createListener((action, dispatch) => {\n  console.log('Received action:', action.type);\n  if (action.meta && action.meta.async) {\n    fetch(action.payload.url)\n      .then(res => res.json())\n      .then(data => dispatch({ type: action.type + '_SUCCESS', payload: data }))\n      .catch(err => dispatch({ type: action.type + '_FAIL', payload: err }));\n  }\n}).addRule(/^FETCH_/, (action) => ({ ...action, payload: { url: `/api/${action.type.slice(6).toLowerCase()}` } }));\n\nconst reducer = (state = {}, action) => {\n  switch (action.type) {\n    case 'FETCH_USER_SUCCESS':\n      return { ...state, user: action.payload };\n    default:\n      return state;\n  }\n};\n\nconst store = createStore(reducer, applyMiddleware(middleware));\n\ndispatch({ type: 'FETCH_USER', meta: { async: true } });","lang":"javascript","description":"Shows setup of middleware, listener with rule that transforms actions before async fetch, and dispatching."},"warnings":[{"fix":"Use with redux 3.x or upgrade to alternative like redux-saga or redux-observable.","message":"Peer dependency on redux 3.x; not tested with redux 4+.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider using redux-saga, redux-observable, or @reduxjs/toolkit listener middleware.","message":"Package has not been updated since 2016; no TypeScript definitions, no modern ES module bundling.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Return a new object in rule transform instead of mutating: (action) => ({ ...action, payload: '...' })","message":"Listener rule transform mutates action (Object.assign) in README example, which may break other middleware or reducers expecting immutability.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Plan lifecycle carefully or use middleware that supports dynamic removal.","message":"No way to remove a listener once added; memory leak if listeners accumulate.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Migrate to actively maintained alternatives.","message":"Package appears unmaintained: no repository link in npm, last commit years ago.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use: import listen from 'redux-listener-middleware'; const middleware = listen(); then middleware.createListener(...)","cause":"Importing wrong symbol or not calling listen() factory.","error":"TypeError: middleware.createListener is not a function"},{"fix":"Run: npm install redux-listener-middleware (note: 'redux' not 'redux')","cause":"Package not installed or typo in import path.","error":"Cannot find module 'redux-listener-middleware'"},{"fix":"Either keep thunk middleware before listener, or ensure async dispatch returns plain objects.","cause":"Dispatching a function or promise without thunk middleware; listener is not designed to replace thunks entirely for async actions.","error":"Uncaught Error: Actions must be plain objects. Use custom middleware for async actions."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}