Skip to content

Commit d9d39b0

Browse files
committed
fix: use the correct link name for find by href for findListByHref
1 parent a862d84 commit d9d39b0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/app/core/data/base/base-data.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,9 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
358358
for (const object of remoteDataObject.payload.page) {
359359
if (hasValue(object?._links)) {
360360
for (const followLinkName of Object.keys(object._links)) {
361-
// only add the followLinks if they are embedded
362-
if (hasValue(object[followLinkName]) && followLinkName !== 'self') {
361+
// only add the followLinks if they are embedded, and we get only links from the linkMap with the correct name
362+
const linkDefinition = getLinkDefinition((remoteDataObject.payload as any).constructor, followLinkName);
363+
if (linkDefinition?.propertyName && hasValue(remoteDataObject.payload[linkDefinition.propertyName]) && followLinkName !== 'self') {
363364
// followLink can be either an individual HALLink or a HALLink[]
364365
const followLinksList: HALLink[] = [].concat(object._links[followLinkName]);
365366
for (const individualFollowLink of followLinksList) {

0 commit comments

Comments
 (0)