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

Feature request: mergePartial

Open ivanvanderbyl opened this issue 1 year ago • 3 comments

Hi team, I really love the work you're doing bringing protobufs to the browser!

Feature request:

One use case we have is using a Message<T> as the value of our internal state for some of the UI. This works really nicely because it's typed and can be marshalled/unmarshalled easily. However, we often want to deep merge another PartialMessage<T> into that state. Something like proto3.util.initPartial(), except instead of replacing nested values it merges them left to right.

Other things we have considered

  • Using deepMerge from lodash. Works in v0.2.x so long as you don't have any 64bit ints in your schema. Broken in v0.3.x
  • Attempted porting initPartial to do a mergePartial, but it was fairly complex. I might give it another go and open a PR.

ivanvanderbyl avatar Nov 26 '22 00:11 ivanvanderbyl