altinn-studio
altinn-studio copied to clipboard
Deleting a definition does not clean up references
Describe the bug
Deleting a definition in our data model editor does not "clean up" references to that definition. This leaves fields that reference a model that does not exist.
We should also have some sort of warning stating that a definition is actually referenced when trying to delete it.
To Reproduce
Steps to reproduce the behavior:
- Go to data model editor
- Add a definition
- Add a reference to that definition
- Delete the definition
- See that the ref now references a non-exsting element.
- Trying to navigate to the type crashes the editor
Expected behavior
Should be warned that definition has references before deleting.
What is expected behavior for the reference?
- Just remove the ref? Seems most likely.
- Convert to object?
Need to investigate.
Screenshots
Would be nice to fix the crash as well. Those crashes are annoying when editing references in layout files.
@Febakke could we discuss this a bit to see if we can improve the usability when deleting types?
@Febakke we should decide how the solution should behave when user tries to delete a type that is referenced from the data model. Could we f.ex. say that it is not possible to delete a type definition when it is referenced from the data model? And to delete the type definition, one must first delete all references to the type in the model? cc: @RonnyB71