umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

After "empty recycle bin" the linked "UMB" entries are not deleted too. #10901

Closed a-t-k closed 3 years ago

a-t-k commented 3 years ago

Which exact Umbraco version are you using? For example: 8.13.1 - don't just write v8

8.15.2

Bug summary

Create child item Create parent Item with "Multinode Treepicker" On parent Item add child item in "Multinode Treepicker"

When 1 - Delete child Item (it is now "recycle bin" and has flag "recycled") 2 - Empty recycle bin, so item is deleted

Then Parent item has in "Multinode Treepicker" entry for deleted child item "umb://document/5b51c940579c4231b3e662eb2b3d3f6f"

Specifics

Create child item Create parent Item with "Multinode Treepicker" On parent Item add child item in "Multinode Treepicker"

When 1 - Delete child Item (it is now "recycle bin" and has flag "recycled") 2 - Empty recycle bin, so item is deleted

Then Parent item has in "Multinode Treepicker" entry for deleted child item "umb://document/5b51c940579c4231b3e662eb2b3d3f6f"

Steps to reproduce

Create child item Create parent Item with "Multinode Treepicker" On parent Item add child item in "Multinode Treepicker"

When 1 - Delete child Item (it is now "recycle bin" and has flag "recycled") 2 - Empty recycle bin, so item is deleted

Then Parent item has in "Multinode Treepicker" entry for deleted child item "umb://document/5b51c940579c4231b3e662eb2b3d3f6f"

Expected result / actual result

The entry "umb://document/5b51c940579c4231b3e662eb2b3d3f6f" is deleted too.

nathanwoulfe commented 3 years ago

Hi @a-t-k, I believe this is by design - it would be an expensive operation for Umbraco to find and remove all references to the deleted node, as it would require updating properties, caches and so on. This would be compounded if the deleted node had children/descendants.

However, IMO it's not really an issue, please see my repro steps:

From what I can see, ModelsBuilder manages this fine on the frontend - the deleted node isn't in the property data when I render the page, I'm assuming the property value converter is ignoring unpublished/trashed entities.

nul800sebastiaan commented 3 years ago

Indeed this is very much by design to make sure that deleting an item doesn't cause a big cascade of having to look through potentially 1000s of nodes, reading and/or deserializing (1000s each property) on each node to check for orphans and then potentially having to write and republish (1000s each property).

As mentioned all property editors should gracefully be handling missing references. If they don't then we can look into that.

As for your frontend, this requires a bit of defensive coding, so you should always expect that a UDI does not exist any more while writing code for your templates.

Hope this provides some clarity and I'll close the issue as "by design".