File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 isNotEmptyOperator ,
2929} from '../../../shared/empty.util' ;
3030import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model' ;
31+ import { getLinkDefinition } from '../../cache/builders/build-decorators' ;
3132import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service' ;
3233import { CacheableObject } from '../../cache/cacheable-object.model' ;
3334import { RequestParam } from '../../cache/models/request-param.model' ;
@@ -301,8 +302,9 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
301302 tap ( ( remoteDataObject : RemoteData < T > ) => {
302303 if ( hasValue ( remoteDataObject ?. payload ?. _links ) ) {
303304 for ( const followLinkName of Object . keys ( remoteDataObject . payload . _links ) ) {
304- // only add the followLinks if they are embedded
305- if ( hasValue ( remoteDataObject . payload [ followLinkName ] ) && followLinkName !== 'self' ) {
305+ // only add the followLinks if they are embedded, and we get only links from the linkMap with the correct name
306+ const linkDefinition = getLinkDefinition ( ( remoteDataObject . payload as any ) . constructor , followLinkName ) ;
307+ if ( linkDefinition ?. propertyName && hasValue ( remoteDataObject . payload [ linkDefinition . propertyName ] ) && followLinkName !== 'self' ) {
306308 // followLink can be either an individual HALLink or a HALLink[]
307309 const followLinksList : HALLink [ ] = [ ] . concat ( remoteDataObject . payload . _links [ followLinkName ] ) ;
308310 for ( const individualFollowLink of followLinksList ) {
You can’t perform that action at this time.
0 commit comments