View deleted without notice on deletion of content type

Created on 7 February 2020, over 4 years ago
Updated 28 June 2024, 2 months ago

Problem/Motivation

When a content type is deleted that has fields used in a view and is the _only_ content type using these fields, the entire view is deleted as well without notice. The fields that are affected by removing the content type are indeed listed in the overview of what is going to be deleted, but not the view(s).

Steps to reproduce

- Create a content type
- Add one field to this that does not exist on any other content type
- Create a new View displaying all content (so no filter on content type)
- Add the field to the Views fields
- Save the View
- Delete the content type
- Check the deletion warning, this does NOT show the View
- Press delete
- Check if the View still exists: nope it doesn't

Proposed resolution

TBA

Remaining tasks

Patch
Review
Commit

User interface changes

TBA

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Views 

Last updated about 11 hours ago

Created by

🇩🇪Germany Publishing Future Ammerbuch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone New Zealand

    I tested this on Drupal 10.1.x, standard install, and confirmed the problem still exists. I have updated the patch a bit. No fix though.

  • Status changed to Postponed: needs info about 1 year ago
  • 🇷🇴Romania vasike Ramnicu Valcea

    hmm. tricky thing, imho

    If i delete the field, i got the View listed in the confirmation form, But to be updated, which makes sense.

    If i delete the content type with the field, we do not have those dependencies "recursively", so we can get also the fields dependencies.
    And the results, as issue says, it deletes the View - which i don't think it should happen, if we have another content types.

    imho, It should the same as for field, the Dependent Views should be updated only.
    Imagine there could be plenty of Content types and different Views, that actually wants to use this field, if exists.
    It will delete all of the Views, it would be "nicer" to update them.

    So this looks like a complex problem about removing Dependent Configs (or whatever).
    Maybe unify the code used in the "background" and the one used for UI.
    And i don't know if there is an existing issue, already.

    Anyway, i think, this requires some discussions ... at least

    So, i changed the status, maybe we'll have more questions to lead us to a plan, for start.

  • 🇺🇸United States birchy82

    I can confirm this issue happens on Drupal 9.5.10. I recently deleted unused Vocabularys and suddenly the Admin Content view was deleted. I thought I was crazy because right before that I was deleting some unused content types and another set of views were deleted as well.

  • 🇺🇸United States joshua.boltz

    It seems that this issue is still happening in Drupal 10.1, as I've removed a content type and on drush cex I notice the entire view is deleted, which is not ideal because that view is still used in conjunction with other remaining content types.

  • Status changed to Active 4 months ago
  • 🇳🇿New Zealand quietone New Zealand

    I think the status here should be active to allow discussion of a solution.

  • 🇮🇳India Shani Maurya Mumbai

    I tested this on Drupal 10.1.6, standard install, and confirmed the problem still exists.

Production build 0.71.5 2024