protobuf-ts icon indicating copy to clipboard operation
protobuf-ts copied to clipboard

Make repeated field merging consistent

Open jcready opened this issue 2 years ago • 0 comments

This addresses https://github.com/timostamm/protobuf-ts/discussions/319

Setup

const source = { bars: [1],    foos: [{ foo: 1 }] };
const target = { bars: [2, 3], foos: [{ foo: 2 }, { foo: 3 }] };
reflectionMergePartial(SomeMessageType, target, source);

Before PR

Repeated Field Scalar/Enum Message
result target array is referentially equal to original target array :x: :white_check_mark:
result target array is deeply equal to source array :white_check_mark: :x:
result target array is NOT referentially equal to source array :white_check_mark: :white_check_mark:

After PR

Repeated Field Scalar/Enum Message
result target array is referentially equal to original target array :white_check_mark: :white_check_mark:
result target array is deeply equal to source array :white_check_mark: :white_check_mark:
result target array is NOT referentially equal to source array :white_check_mark: :white_check_mark:

jcready avatar Jun 19 '22 15:06 jcready