Immer now works with Aurelia store

As noted by Kalle on the discord with the new release of ImmerJS, you can now use it correctly with Aurelia store. In a nutshell:

  1. Disable auto-freeze with setAutoFreeze(false);
  2. Write your actions like this:
export const selectBackend = produce((state: State, selectedBackend: SelectableBackend) => {
    state.selectedBackend = selectedBackend;
  1. Only modify the state directly: immer will track its modification to create a new object but won’t modify the existing one. If you modify any other parameter directly, it will be mutated.

If you need more details, I wrote a detailed blog post.


Thanks for the update and the great detailed blog post @Jenselme. Might want to submit it to in order to reach a larger audience.

@Jenselme Well done!
@zewa666 Interesting :rofl:

So, Friends, before Vildan and I come to you, submit your articles to Aurelia weekly :stuck_out_tongue: :joy: :smiling_imp: