Skip to content

Prep work for new item select modal

Andreas Pittrich requested to merge item-select-prep into main

In this MR I test out another approach to avoid circular dependencies when using modals, that are supposed to be part of themes.

In this case the subject is the ItemSelectModal.

How to test?

  • Serve the PAT app and click 'Meine Daten teilen'. That should spawn a modal to select `SymptomChecks.
  • Go to BengalInjectionsModule in /lib/themes/bengal/_injections and uncomment the provider line.
  • Serve the PAT app again and click 'Meine Daten teilen'. Instead of the previous modal you should now only see 'ABC' in the upper left corner of the modal.

How does this break circular dependencies?

The SelectItemService which spawns the modal has it's own default modal, that does not depend on the theme. The Theme provides the overwrite ModalComponent at runtime after/during initialization. The latter one can make use of theme components because everything has already been initialized. The modal component itself gets rendered at runtime.

How to use?

Whenever a module in @rcc/common needs a modal depending on a theme, it should not import it from @rcc/theme active; instead it should export a base modal class and use it as injection token. Each theme can then extend that class and provide the extension: add provider with the extension to BengalInjectionsModule.

Edited by Andreas Pittrich

Merge request reports

Loading