I debug your applyChangesToRecord and i think array fields are not managed as it should be!
Scenario 1: My array field(linkedEvents) contains one element on initial load ex: [5]. On a sync request, i clear all values of the linkedEvents ex: []. In the applyChangesToRecord, the rawChanges contains the new value but the rowChangesSimplePaths have lost my linkedEvents field so my linkedEvents change is ignored!
Scenario 2: My array field(linkedEvents) is empty on initial load ex: []. On a sync request, i add a value to the linkedEvents ex: [5]. In the applyChangesToRecord, the rawChanges contains the new value but the rowChangesSimplePaths flatten my linkedEvents ex: linkedEvents.0: 5 The change is added to the record but as a "linkedEvents.0" property. It should fill my linkedEvents.
Is it a bug on your side or should i manage array field differently?
for (const key in rawChanges) {
if (Object.prototype.hasOwnProperty.call(rawChanges, key) && !done[key]) {
rawChangesFiltered[key] = rawChanges[key];
}
}
const rowChangesSimplePaths = _Core_helper_ObjectHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"].pathifyKeys(rawChangesFiltered); // Collect the changes into a change set for field names.
for (const dataSource in rowChangesSimplePaths) {
const field = fieldDataSourceMap[dataSource],
propName = field ? field.name : dataSource,
value = modelClass.processField(propName, rowChangesSimplePaths[dataSource]),
oldValue = dataSource in recProto ? record[propName] : _Core_helper_ObjectHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"].getPath(data, dataSource);
if (!(field !== null && field !== void 0 && field.isEqual ? field.isEqual(oldValue, value) : _Core_helper_ObjectHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"].isEqual(oldValue, value))) {
hasChanges = true;
changes[propName] = value;
}
}