ionic-team / stencil-redux

MIT License
97 stars 20 forks source link

can't use redux-thunk's withExtraArgument mechanism with @stencil/redux #17

Open ntregillus opened 5 years ago

ntregillus commented 5 years ago

Since @stencil/redux has the peer dependency, I expectd that I could use redux middle where Thunk.

However, the MapDispatchToProps method is not handling the middleware's ability to inject another parameter into the delegate.

for example. normal delegate actions looks like:

export function executeAction() {
  return (dispatch, getStore) {
   dispatch({type: MY_ACTION, ...});
  };
}

and Thunk describes a feature withExtraArgument which should allow me to include my API Client the same way the getStore and dispatch actions are provided:

export function executeAction() {
  return (dispatch, getStore, apiClient) {
   dispatch({type: MY_ACTION, ...});
  };
}

However the Stencil code is ignoring this middleware.... I was wondering why this doesn't work....

ntregillus commented 5 years ago

Note: I was able to work around this by adding another reducer to my state to provide the client via the getState() endpoint