Support maps in immer
rafpaz opened this issue · comments
Description
When using es6 Maps inside store, immer throws the following error:
Uncaught Error: [Immer] The plugin for 'MapSet' has not been loaded into Immer. To enable the plugin, import and call
enableMapSet() when initializing your application.
.
On our app, we use immer with zustand, and just adding:
import { enableMapSet } from 'immer';
enableMapSet();
solved it.
Steps
- Create a store with a map object, for example:
export const storeWithMap = createStore('storeWithMap')({ tasks: new Map<string, Task>() });
- App crashes with the above error
Expectation
Would be really nice if it will be possible to add another property into immer's options object on createStore, for enabling maps usage.