commodo icon indicating copy to clipboard operation
commodo copied to clipboard

withFields - on the "fields" field, add "id" field for better handling of lists

Open adrians5j opened this issue 5 years ago • 0 comments

Currently, when you send data to a list of models (using fields field), the new data is just assigned and the old is lost.

This means that the data will always be marked as dirty, when in fact, only one field might have been changed. This prevents the users to do isDirty() checks completely.

By assigning IDs (a simple "id" field for every item), we can actually efficiently compare received data and current data in the field, and completely fix the problem explained above.

P.S. This should also tackle the following ~value: []~ we needed to make here:

fields({ list: true, instanceOf: LockedFieldsModel, value: [] })

adrians5j avatar May 26 '20 10:05 adrians5j