Use automerge for defaults and ensure correct typing.

Review Request #13895 — Created May 24, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

This change accomplishes 3 things related to the defaults member for
models.

First, it fixes up the typing for the defaults definitions in all the
models that we've implemented so far to be Result<Partial<AttrsType>>.

Second, for things that inherit from base classes, we now rely on
automerge instead of manually calling _.defaults().

Finally, we had a few instances where the defaults were including
objects or arrays but were implemented as a plain object instead of a
function. We've had problems in the past where these weren't deep
copied, and multiple objects ended up sharing the same object or array
value. These have been fixed up to always be a function that returns new
data.

Ran js-tests.

Summary ID
Use automerge for defaults and ensure correct typing.
This change accomplishes 3 things related to the `defaults` member for models. First, it fixes up the typing for the `defaults` definitions in all the models that we've implemented so far to be `Result<Partial<AttrsType>>`. Second, for things that inherit from base classes, we now rely on automerge instead of manually calling `_.defaults()`. Finally, we had a few instances where the defaults were including objects or arrays but were implemented as a plain object instead of a function. We've had problems in the past where these weren't deep copied, and multiple objects ended up sharing the same object or array value. These have been fixed up to always be a function that returns new data. Testing Done: Ran js-tests.
26d5a9fa4229acd5ea7cc66c239feb00fe058c08
Description From Last Updated

Should be Result<Partial<...>>.

chipx86chipx86
chipx86
  1. 
      
  2. Show all issues

    Should be Result<Partial<...>>.

  3. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.x (03b7437)