Using Immer to compress Immer patches

Immer is a great immutable library for javascript by Michel Weststrate

Using this library and tracking patches, I’ve noticed the patch list can really grow if you are issuing updates frequently. Here’s a bit of sample code for taking a long list of patches and shortening them to only the list that gets you from the initial state to the last state.