altinn-studio icon indicating copy to clipboard operation
altinn-studio copied to clipboard

Deleting a definition does not clean up references

Open lorang92 opened this issue 2 years ago • 3 comments

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:

  1. Go to data model editor
  2. Add a definition
  3. Add a reference to that definition
  4. Delete the definition
  5. See that the ref now references a non-exsting element.
  6. 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

Altinn Studio (3)

lorang92 avatar Oct 25 '21 14:10 lorang92

Would be nice to fix the crash as well. Those crashes are annoying when editing references in layout files.

ivarne avatar Oct 25 '21 16:10 ivarne

@Febakke could we discuss this a bit to see if we can improve the usability when deleting types?

RonnyB71 avatar Jan 12 '22 10:01 RonnyB71

@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

nkylstad avatar Aug 08 '22 10:08 nkylstad