From 643e75a838913cdf4757e06c8090d1f1d8f8cb51 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Tue, 11 Apr 2023 17:50:50 +0200 Subject: [PATCH] 101108: Angular 14 upgrade - build fixes #1 --- src/app/core/cache/builders/link.service.ts | 6 +++--- src/app/core/cache/builders/remote-data-build.service.ts | 2 +- src/config/app-config.interface.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/core/cache/builders/link.service.ts b/src/app/core/cache/builders/link.service.ts index b7af54abf7..afc7ab88e4 100644 --- a/src/app/core/cache/builders/link.service.ts +++ b/src/app/core/cache/builders/link.service.ts @@ -60,7 +60,7 @@ export class LinkService { const provider = this.getDataServiceFor(matchingLinkDef.resourceType); if (hasNoValue(provider)) { - throw new Error(`The @link() for ${linkToFollow.name} on ${model.constructor.name} models uses the resource type ${matchingLinkDef.resourceType.value.toUpperCase()}, but there is no service with an @dataService(${matchingLinkDef.resourceType.value.toUpperCase()}) annotation in order to retrieve it`); + throw new Error(`The @link() for ${String(linkToFollow.name)} on ${model.constructor.name} models uses the resource type ${matchingLinkDef.resourceType.value.toUpperCase()}, but there is no service with an @dataService(${matchingLinkDef.resourceType.value.toUpperCase()}) annotation in order to retrieve it`); } const service: HALDataService = Injector.create({ @@ -79,12 +79,12 @@ export class LinkService { return service.findByHref(href, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); } } catch (e) { - console.error(`Something went wrong when using @dataService(${matchingLinkDef.resourceType.value}) ${hasValue(service) ? '' : '(undefined) '}to resolve link ${linkToFollow.name} at ${href}`); + console.error(`Something went wrong when using @dataService(${matchingLinkDef.resourceType.value}) ${hasValue(service) ? '' : '(undefined) '}to resolve link ${String(linkToFollow.name)} at ${href}`); throw e; } } } else if (!linkToFollow.isOptional) { - throw new Error(`followLink('${linkToFollow.name}') was used as a required link for a ${model.constructor.name}, but there is no property on ${model.constructor.name} models with an @link() for ${linkToFollow.name}`); + throw new Error(`followLink('${String(linkToFollow.name)}') was used as a required link for a ${model.constructor.name}, but there is no property on ${model.constructor.name} models with an @link() for ${String(linkToFollow.name)}`); } return EMPTY; diff --git a/src/app/core/cache/builders/remote-data-build.service.ts b/src/app/core/cache/builders/remote-data-build.service.ts index 76529891d4..1124ecfc7a 100644 --- a/src/app/core/cache/builders/remote-data-build.service.ts +++ b/src/app/core/cache/builders/remote-data-build.service.ts @@ -72,7 +72,7 @@ export class RemoteDataBuildService { if (hasValue(obj)) { if (getResourceTypeValueFor((obj as any).type) === PAGINATED_LIST.value) { return this.buildPaginatedList(obj, ...linksToFollow); - } else if (isNotEmpty(linksToFollow)) { + } else if (isNotEmpty(linksToFollow) && obj instanceof HALResource) { return [this.linkService.resolveLinks(obj, ...linksToFollow)]; } } diff --git a/src/config/app-config.interface.ts b/src/config/app-config.interface.ts index e3f8988744..84a30549a7 100644 --- a/src/config/app-config.interface.ts +++ b/src/config/app-config.interface.ts @@ -56,7 +56,7 @@ interface AppConfig extends Config { */ const APP_CONFIG = new InjectionToken('APP_CONFIG'); -const APP_CONFIG_STATE = makeStateKey('APP_CONFIG_STATE'); +const APP_CONFIG_STATE = makeStateKey('APP_CONFIG_STATE'); export { AppConfig,