• merge two sets of patches created by immer produce. newPatches take precedent over oldPatches for patches modifying the same path. In the case many consecutive pathces are merged the original model should always be the root model.

    Example: A -> B, patches1 B -> C, patches2

    mergePatches(A, patches1, patches2) to get patches for A -> C

    Type Parameters

    • T

    Parameters

    • originalSource: T

      the original Model the patches should be applied to

    • oldPatches: Patch[]

      immer produce patch list

    • newPatches: Patch[]

      immer produce patch list (will take precedence)

    Returns Patch[]

    merged patches