Skip to content

Commit 7f3164a

Browse files
authored
fix: If no key attribute is defined for the entity, the logic to add association to ChangeView should be skipped. (#80)
Adopting "Change-tracking" library: BEM project repo: https://github.tools.sap/Climate-21/c21-networkcalculation-srv Reproduce PR: https://github.tools.sap/Climate-21/c21-networkcalculation-srv/pull/2386 The step “npm run build” fails currently at entity FlowModelService.senderNodeEnergyCarrier (https://github.tools.sap/Climate-21/c21-networkcalculation-srv/blob/94cb4d6048aa69a5a368e02c2311b17d30d9da94/srv/model/FlowModelService.cds#L478). Error Message: <img width="1020" alt="image" src="https://github.com/cap-js/change-tracking/assets/132032144/32c82991-0d04-43fb-ae50-26ff5277f659"> Best Regards Jocelyn
1 parent 426e510 commit 7f3164a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cds-plugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ cds.on('loaded', m => {
4040
const keys = [], { elements: elms } = entity
4141
for (let e in elms) if (elms[e].key) keys.push(e)
4242

43+
// If no key attribute is defined for the entity, the logic to add association to ChangeView should be skipped.
44+
if(keys.length === 0) {
45+
continue;
46+
}
47+
4348
// Add association to ChangeView...
4449
const on = [...changes.on]; keys.forEach((k, i) => { i && on.push('||'); on.push({
4550
ref: k === 'up_' ? [k,'ID'] : [k] // REVISIT: up_ handling is a dirty hack for now

0 commit comments

Comments
 (0)