angular-redux / ng-redux

Angular bindings for Redux
MIT License
1.16k stars 177 forks source link

connect calls subscribes on a store even the first param to connect is null #102

Closed ipassynk closed 8 years ago

ipassynk commented 8 years ago

Looks like the connect function from ng-redux subscribes to the store even mapStateToProps param is null? Redux-react docs says: "If you omit it, the component will not be subscribed to the Redux store. "

I am doing the following and see that a new subscription is created.

this.$ngRedux.connect(null,
      {
        setAgreementsFormState: clientActionsService.setAgreementsFormState.bind(clientActionsService),
        updateAllTotals: clientActionsService.updateAllTotals.bind(clientActionsService)
      })(this);
wbuchwalter commented 8 years ago

ng-redux is not a port of react-redux to angular. They have a similar API and concepts but that's it. So you shouldn't read the doc of react-redux and expect that to apply to ng-redux. This specific behaviour is indeed not implemented in ng-redux. Simplest way to do it is just do unsubscribe directly. It's a little bit less elegant :)

ipassynk commented 8 years ago

Got it. May be you can add this clarification into the documentation. Thanks.