-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
This plugin is introducing a side effect in the following line:
Line 183 in d537795
const assoc = { ...changes, on: [ ...changes.on, ...keys ] } |
The reason is, that you are copying the properties of an object, but not the functions.
The following @sap/cds function is expecting this object to have an .is
function, which then causes an error:
line 140 in @sap/cds/lib/core/linked-csn.js
The @cap-js/attachments plugin for instance is invoking this code through this line and hence running into this issue: https://github.com/cap-js/attachments/blob/main/lib/plugin.js#L13
To reproduce the issue:
- Create a CAP project with both plugins @cap-js/attachments and @cap-js/change-tracking.
- Make sure that the dependency of the change-tracking plugin is listed after the attachment plugin in the dependencies of the package.json
- The reason for this is, that both plugins are registering a handler for the
compile.to.edmx
event and the handlers are executed in the registration order. Only when the change-tracking plugin code runs first, the issue occurs.
Solution would be to create a deep copy of the object.
Metadata
Metadata
Assignees
Labels
No labels