Skip to content

Selector can return undefined despite its type definition #1095

@lukasrad02

Description

@lukasrad02

The createSelectElementFromMapFactory creates selectors to select basic elements (patients, vehicle, personnel, …) from the state based on their UUID. The created selectors contain an assertion that the element is defined. This is not accurate, as for example, one might still have the UUID of an already deleted element.

Even defensive code does not protect against access to undefined values in these cases. For example, in the user interface added in #1076, one can trigger access to undefined by deleting a simulated region while its opened in the IFS modal. Although the modal switches back to the overview tab if a region does not exist any longer, the observables on the simulated region already trigger with the new value (undefined), thus causing some errors printed to the console.

Changing the type definition to be more accurate might require bigger changes, as the base selectors created by createSelectElementFromMapFactory are used in many places and also as the base for many other selectors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendIssues mainly related to the frontendrefactoringIssues related to refactoring existing code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions