Easy-peasy: Support Map and Set with immer and/or immer-peasy

Created on 26 Feb 2020  ·  6Comments  ·  Source: ctrlplusb/easy-peasy

I just discovered that I can't use Map because the changes are not included/rebased into immer-peasy.

Is that intentional? How can I help?

feature-request

Most helpful comment

@ctrlplusb Gave 3.4.0-beta.1 a spin and things look awesome, thanks so much. I was wondering whether easy-peasy should somehow wrap / expose immer's enableMapSet function. Maybe as a field in store config? It's a bit strange to have to import immer just to call enableMapSet especially when the app doesn't have immer as a direct dependency.

All 6 comments

Hey @rmariuzzo

Yep, this is intentional for now. The immer package jumped quite dramatically in size for this feature. It's already a pretty hefty dependency.

I am waiting on the following PR to merge in their repo and then will be moving to standard immer package along with a patching mechanism:

https://github.com/immerjs/immer/pull/536

Thank you for your quick reply! I will use an object for now. Also, I may reference your reply in a upcoming talk that I will present in a couple of months about “easy-peasy”.

Awesome to hear. Let me know if you need any more information to help with your talk. 💜

FYI, I have opened a PR #447 to switch to the latest immer. I have to bind to a specific version of immer (version 6.0.1) as I use patch-package to make a small adjustment allowing us to use computed properties with immer. This means I no longer need to maintain my own fork.

I have released this as an alpha ([email protected]) and would appreciate your feedback on it. If you add immer to your project please make sure to install the same version so as to avoid duplicate dependencies.

You should be able to configure support for Map and Set as described in the immer docs.

I've added a test case to ensure this works as expected. 💜

@ctrlplusb Gave 3.4.0-beta.1 a spin and things look awesome, thanks so much. I was wondering whether easy-peasy should somehow wrap / expose immer's enableMapSet function. Maybe as a field in store config? It's a bit strange to have to import immer just to call enableMapSet especially when the app doesn't have immer as a direct dependency.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coooolers picture coooolers  ·  5Comments

Windynik picture Windynik  ·  5Comments

giacomorebonato picture giacomorebonato  ·  5Comments

vincentjames501 picture vincentjames501  ·  6Comments

ifyoumakeit picture ifyoumakeit  ·  5Comments