You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we know, conversation is a inline composition of child entity, This is an unmanaged case. If we want to enable managed for inline composition of child entity, It can be set up as shown below:
Above is the background information, then the problem is in the following figure, when we go to an incident page, we will find that there is already a current conversation, so we create a new conversation:
And click 'Save' button, you can see that the change history generates two changelogs, but we see that there is an additional changelog generated, which we don't need because we haven't done anything with the original conversation:
When we enable aspect managed, generate changelog normally:
The reason is:
In req.diff(), the data is logged regardless of whether that data has been manipulated or not, so for the managed case, change-tracking will have a place for logic to filter out data that hasn't been manipulated, because for change-tracking, if it hasn't been manipulated, it shouldn't be logged:
// Since req.diff() will record the managed data, change history will filter those logs only be changed managed dataconstmanagedAttrs=["modifiedAt","modifiedBy"]if(curChange.modification==="update"){constrowOldAttrs=Object.keys(childNodeChange._old)constdiffAttrs=rowOldAttrs.filter((attr)=>managedAttrs.indexOf(attr)===-1)if(!diffAttrs.length){return}}
But for the unmanaged case, the unmanipulated data has no _op in req.diff(), so by the time we get to the logic above, the value of curChange.modification is undefined, so it skips the filtering and is added directly to the changelog, so here's the solution:
If you have time, please take a look at this scenario.
Best Regards,
Wenjun
The text was updated successfully, but these errors were encountered:
Hi,
Here's the situation in incidents-app:
Model:
Annotation:
As we know, conversation is a inline composition of child entity, This is an
unmanaged
case. If we want to enablemanaged
for inline composition of child entity, It can be set up as shown below:Above is the background information, then the problem is in the following figure, when we go to an incident page, we will find that there is already a current conversation, so we create a new conversation:
And click 'Save' button, you can see that the change history generates two changelogs, but we see that there is an additional changelog generated, which we don't need because we haven't done anything with the original conversation:
When we enable aspect
managed
, generate changelog normally:The reason is:
In
req.diff()
, the data is logged regardless of whether that data has been manipulated or not, so for themanaged
case, change-tracking will have a place for logic to filter out data that hasn't been manipulated, because for change-tracking, if it hasn't been manipulated, it shouldn't be logged:https://github.com/cap-js/change-tracking/blob/main/lib/change-log.js#L189
But for the
unmanaged
case, the unmanipulated data has no_op
inreq.diff()
, so by the time we get to the logic above, the value ofcurChange.modification
is undefined, so it skips the filtering and is added directly to the changelog, so here's the solution:If you have time, please take a look at this scenario.
Best Regards,
Wenjun
The text was updated successfully, but these errors were encountered: