From d9d39b0cb5f1aed5ff7ec9c51c60fb354232a01c Mon Sep 17 00:00:00 2001 From: pcg-kk Date: Tue, 13 Aug 2024 19:36:02 +0200 Subject: [PATCH] fix: use the correct link name for find by href for findListByHref --- src/app/core/data/base/base-data.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/core/data/base/base-data.service.ts b/src/app/core/data/base/base-data.service.ts index 56f0c2fc26..b47deb339c 100644 --- a/src/app/core/data/base/base-data.service.ts +++ b/src/app/core/data/base/base-data.service.ts @@ -358,8 +358,9 @@ export class BaseDataService implements HALDataServic for (const object of remoteDataObject.payload.page) { if (hasValue(object?._links)) { for (const followLinkName of Object.keys(object._links)) { - // only add the followLinks if they are embedded - if (hasValue(object[followLinkName]) && followLinkName !== 'self') { + // only add the followLinks if they are embedded, and we get only links from the linkMap with the correct name + const linkDefinition = getLinkDefinition((remoteDataObject.payload as any).constructor, followLinkName); + if (linkDefinition?.propertyName && hasValue(remoteDataObject.payload[linkDefinition.propertyName]) && followLinkName !== 'self') { // followLink can be either an individual HALLink or a HALLink[] const followLinksList: HALLink[] = [].concat(object._links[followLinkName]); for (const individualFollowLink of followLinksList) {