-
Notifications
You must be signed in to change notification settings - Fork 15
Redux-Immutable support #44
Comments
I'm not familiar with |
Sort of a plugin should be possible (or just some simple documentation on how to implement immutable support). The reducer implementation would need to change a bit. Taking the completeReducer as an example, it could look something like (the helper functions being part of the configuration with the plain JS functions as defaults. Haven't tested the code nor thought that much about it, just a demonstration of the idea.
I've got some other things I need to finish today. But I think that in Does this seem like a good solution to you? |
Yes this seems like a fine solution to me. My main concern would be the API for hooking into the internals. Obviously the less complicated and obtrusive the better. I would prefer all the config to be required at initialisation rather than e.g. at place of component decoration - do you have thoughts on this? |
I agree, should be done at initialisation and shouldn't be to complicated to implement. |
@sdgluck Is there a working example of v4 somewhere? I'm can't seem to get the wrapped components to update. |
@olapersson Not a public example, unfortunately. Working on getting a boilerplate on here soon. Are you able to provide more details? Do you mean that the component does not fetch new data on props change? Which decorator are you using? |
Sure, here's minimal reproduction https://github.com/olapersson/kasia-debug (you'll need to disable CORS in your browser or point the config at something that allows requests from localhost) The request is dispatched and the store is updated, the props aren't and the shouldUpdate function is never called. |
@olapersson Thank you v. much for the reproducible. 👍 I have pushed a new version to Let me know if that works for you (it does for me using a different wp-api endpoint), and I will merge my changes (#49) and publish. |
Yes, works for me. connectWpPost seems to have a bug still, if leaving the default value for Pushed a repro to master here: https://github.com/olapersson/kasia-debug, keying by slug rather than id works. The request gets it right (uses slug rather than id) while |
Thanks, there's a new version on |
Yeah, working now. :) |
@olapersson Brilliant. Thanks for your help. #49 is on |
In order to use this in a project that uses redux-immutable some functionality would have to be overridden.
I haven't looked that deeply into it yet. But browsing the code in the v4 branch I think a pluggable merge function for the reducers and a pre-processor for _getState could work. I could then pass a function that merges immutable Maps in the reducers and calls
toJS()
on the state before checking for the wordpress key in connect.js.The text was updated successfully, but these errors were encountered: