4Science / dspace-angular

Angular UI for DSpace and DSpace-CRIS. In the dspace-cris-7 branch you can find the extension to support DSpace-CRIS
BSD 3-Clause "New" or "Revised" License
13 stars 28 forks source link

nested metadata values with restricted visibility result in NullInjectorError: No provider for metadataValueProvider! #82

Open saschaszott opened 4 months ago

saschaszott commented 4 months ago

Bug description

If a researcher profile has two (or more) affiliations and the security level / visibility of a start or end date is set to 2 (owner & admin only), a NullInjectorError is thrown. In this case the UI does not show page header and footer:

image

corresponding error messages in JS console:

core.mjs:7739 ERROR NullInjectorError: R3InjectorError(ItemPageModule)[metadataValueProvider -> metadataValueProvider -> metadataValueProvider -> metadataValueProvider]: 
  NullInjectorError: No provider for metadataValueProvider!
    at NullInjector.get (core.mjs:11242:1)
    at R3Injector.get (core.mjs:11409:1)
    at R3Injector.get (core.mjs:11409:1)
    at R3Injector.get (core.mjs:11409:1)
    at NgModuleRef.get (core.mjs:21973:1)
    at R3Injector.get (core.mjs:11409:1)
    at NgModuleRef.get (core.mjs:21973:1)
    at Object.get (core.mjs:21650:1)
    at lookupTokenUsingModuleInjector (core.mjs:3367:1)
    at getOrCreateInjectable (core.mjs:3479:1)
defaultErrorLogger @ core.mjs:7739

core.mjs:7739 ERROR TypeError: Cannot read properties of undefined (reading 'createComponent')
    at Object.next (themed.component.ts:107:31)
    at ConsumerObserver.next (Subscriber.js:91:1)
    at SafeSubscriber._next (Subscriber.js:60:1)
    at SafeSubscriber.next (Subscriber.js:31:1)
    at subscribe.innerSubscriber (switchMap.js:14:104)
    at OperatorSubscriber._next (OperatorSubscriber.js:13:1)
    at OperatorSubscriber.next (Subscriber.js:31:1)
    at Observable._subscribe (innerFrom.js:51:24)
    at Observable._trySubscribe (Observable.js:37:1)
    at Observable.js:31:1
defaultErrorLogger @ core.mjs:7739

core.mjs:7739 ERROR TypeError: Cannot read properties of undefined (reading 'createComponent')
    at Object.next (themed.component.ts:107:31)
    at ConsumerObserver.next (Subscriber.js:91:1)
    at SafeSubscriber._next (Subscriber.js:60:1)
    at SafeSubscriber.next (Subscriber.js:31:1)
    at subscribe.innerSubscriber (switchMap.js:14:104)
    at OperatorSubscriber._next (OperatorSubscriber.js:13:1)
    at OperatorSubscriber.next (Subscriber.js:31:1)
    at map.js:7:1
    at OperatorSubscriber._next (OperatorSubscriber.js:13:1)
    at OperatorSubscriber.next (Subscriber.js:31:1)

Please note, that it is required that the researcher profile has at least 2 affiliations, otherwise the error does not occur.

saschaszott commented 4 months ago

this bug is fixed with PR #83