Hi Isomorphic,
I've debugged some strange issues with DynamicForm "time" fields and discovered that code in isc.DataSource._applySparseAndNoNullUpdates on Date object if they not match it falls thru and thinks that it's just some Object and recursively checks their internal attributes.
By doing that _applySparseAndNoNullUpdates compares internal Date attributes as "logicalDate" "logicalTime" and it sees that they haven't changes and removes attributes from the object. This will instantly make Date objects which has been marked as logical to be not logical and this causes troubles ahead - e.g. serialisation now serialise these in full datetime format during request submission.
Tested on 13.0d, but I feel that this issue is in all versions of the SmartClient.
DataSource._applySparseAndNoNullUpdate:
Suggested solution: (just check if its Date and if it is do second check if values matches).
Sadly I cannot see any workarounds for this issue... only by replacing entire function body with a patched version :)
Please, apply this fix into further versions.
I've debugged some strange issues with DynamicForm "time" fields and discovered that code in isc.DataSource._applySparseAndNoNullUpdates on Date object if they not match it falls thru and thinks that it's just some Object and recursively checks their internal attributes.
By doing that _applySparseAndNoNullUpdates compares internal Date attributes as "logicalDate" "logicalTime" and it sees that they haven't changes and removes attributes from the object. This will instantly make Date objects which has been marked as logical to be not logical and this causes troubles ahead - e.g. serialisation now serialise these in full datetime format during request submission.
Tested on 13.0d, but I feel that this issue is in all versions of the SmartClient.
DataSource._applySparseAndNoNullUpdate:
Code:
if (isc.isA.Date(value) && isc.DateUtil.compareDates(value, oldValue) == 0) { // <- IF THEY MATCH THEN, NO CHANGES, REMOVE FROM LIST, BUT IF NOT MATCH... delete values[key]; } else if (isc.isAn.Array(value)) { // NOT AN ARRAY, ALL OK. for (var i = 0; i < value.length; i++) { this._applySparseAndNoNullUpdates(value[i], oldValue[i], operationType, field == null ? null : isc.DataSource.get(field.type)); var keyCount = 0; for (var k2 in value[i]) keyCount++; if (keyCount == 0) delete value[i]; } // If this process leaves an array full of nulls, don't bother serializing it var goodEntry = false; for (var i = 0; i < value.length; i++) { if (value[i] != null) { goodEntry = true; break; } } if (!goodEntry) delete values[key]; } else if (isc.isAn.Object(value)) { // >>-- FAIL HERE <<- the Date is also an Object, so it starts recursive checking of internal Date properties ?? this._applySparseAndNoNullUpdates(value, oldValue, operationType, field == null ? null : isc.DataSource.get(field.type)); // If this process leaves an object with no properties, get rid of it var keyCount = 0; for (var k2 in value) keyCount++; if (keyCount == 0) delete values[key]; } else if (value == oldValue) { delete values[key]; }
Code:
if (isc.isA.Date(value)) { if (isc.DateUtil.compareDates(value, oldValue) == 0) { delete values[key]; } } else if .....
Sadly I cannot see any workarounds for this issue... only by replacing entire function body with a patched version :)
Please, apply this fix into further versions.
Comment