Redux-debounced support
See original GitHub issuehttps://www.npmjs.com/package/redux-debounced
I’m trying to use redux-debounced which doesn’t work due to how polymer-redux proxies the calls to dispatch. Redux debounced is looking for a meta key off of the function, this doesn’t work due to https://github.com/tur-nr/polymer-redux/blob/master/src/index.js#L180-L190. Which copies the function removing the meta object that I add.
export function trackCustomerSearch(key) { const thunk = dispatch => { console.log('Search Key ----> ', key); }; thunk.meta = { debounce: { time: 2500, key: 'TRACK_CUSTOMER_SEARCH' } }; return thunk; }
My additional question is why is polymer-redux doing that? Is redux-thunk not needed due to those lines? I’d prefer to just use redux-thunk so other redux middlewares will work as expected.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
👍
Plan moving forward is good. With the 2.0 version I’d recommend you emphasize the decoupling of redux from Polymer Redux. Having your action creators in Polymer components creates a tight coupling. We like to have the redux layer be reusable with any frontend framework. We do that like this:
This exposes all the actionCreators to polymer components so they can do
this.dispatch(this.actions.bar())
.And it may even be better to do
Where actions is an object of
{'MY_ACTION_CREATOR': function()}