Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding devtools-extension breaks middleware (ngRedux) #489

Closed
tcjcodes opened this issue Apr 18, 2018 · 2 comments
Closed

Adding devtools-extension breaks middleware (ngRedux) #489

tcjcodes opened this issue Apr 18, 2018 · 2 comments

Comments

@tcjcodes
Copy link

The devTools extension seems to be modifying the arguments that's sent to my app's middleware. If I remove the extension the middleware works as expected.

Devtools logs the actions fine:

image

and then the middlewares fail to receive the correct arguments:
store is undefined, next is correct, and the original action is always wrapped in a PERFORM_ACTION:

image

Below is the ngRedux setup:

($ngReduxProvider: ngRedux.INgReduxProvider) => {
      let middlewares = [
          customMiddleware,
      ];
      $ngReduxProvider.createStoreWith(rootReducer, middlewares, [
          window['__REDUX_DEVTOOLS_EXTENSION__'] && window['__REDUX_DEVTOOLS_EXTENSION__']()       
       ]);
};

where customMiddleware just logs:

export const customMiddleware = (store) => (next) => (action) => {
    debugger;
    console.log('action', action);
    next(action);
};

I'm not sure if this is an ngRedux's setup is not what DevTools is expecting?

versions:
[email protected]
[email protected]

@tcjcodes tcjcodes changed the title Adding devtools-extension breaks middleware (ngRedux ?) Adding devtools-extension breaks middleware (ngRedux) Apr 18, 2018
@kevinmims
Copy link

kevinmims commented Apr 25, 2018

Just ran in to this same issue using middleware; dev tools seems to be wrapping actions in a 'PERFORM_ACTION' type, creating

action: { 
  action: {...}, 
  type: 'PERFORM_ACTION',
  ...
}

Modifying the config from:

$ngReduxProvider.createStoreWith(...reducers, [thunk, middleware], window.__REDUX_DEVTOOLS_EXTENSION__ ? [window.__REDUX_DEVTOOLS_EXTENSION__()] : []);

to

$ngReduxProvider.createStoreWith(...reducers, [thunk, middleware]);

fixes the issue and passes the correct structure to the middleware and all is well again??

@tcjcodes
Copy link
Author

tcjcodes commented Jun 5, 2018

Looks like this is being tracked in ng-redux's repo, closing.
angular-redux/ng-redux#196

@tcjcodes tcjcodes closed this as completed Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants