dspace-angular icon indicating copy to clipboard operation
dspace-angular copied to clipboard

Listable-object decorator ignoring relevant parameters after default value

Open Atmire-Kristof opened this issue 3 years ago • 0 comments

Describe the bug The listable-object decorator uses default values for inputs in situations where it shouldn't. More specifically after it resorts to a default value for one of the fields, all fields that follow will also use default values (in order of view-mode > context > theme). E.g. if the provided context is not found, it'll use the DEFAULT_CONTEXT, ignore the provided theme and also use DEFAULT_THEME, regardless of whether or not there's a component configured for default context and that specific theme.

To Reproduce Steps to reproduce the behavior:

  1. Configure a component for 'TestType', ViewMode.DetailedListElement, DEFAULT_CONTEXT and theme 'custom'
  2. Configure a second component for 'TestType', ViewMode.DetailedListElement, DEFAULT_CONTEXT and DEFAULT_THEME
  3. Call getListableObjectComponent with arguments 'TestType', ViewMode.DetailedListElement, Context.Search and theme 'custom'

It'll return the first component you configured, completely disregarding the 'custom' theme that was provided and use default instead.

Expected behavior It should return the actual most relevant component. In case of the example, it should return the second component configured for theme 'custom'.

Atmire-Kristof avatar Oct 19 '22 12:10 Atmire-Kristof