Skip to content

Commit

Permalink
fix: use the correct link name for find by href for findListByHref
Browse files Browse the repository at this point in the history
  • Loading branch information
pcg-kk committed Aug 13, 2024
1 parent a862d84 commit d9d39b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/core/data/base/base-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,9 @@ export class BaseDataService<T extends CacheableObject> 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) {
Expand Down

0 comments on commit d9d39b0

Please sign in to comment.