When a view display is deleted, the dependencies list is not updated properly

Created on 20 August 2021, about 3 years ago
Updated 6 May 2024, 5 months ago

Problem/Motivation

When you delete a view display (and save the view), the dependencies added by that display are not removed from the dependencies list at the configuration entity for that view. It causes a remaining dependency relationship that shouldn't exist anymore. So, if you try to remove the related configuration, the entire view will be removed together.

The problem is softened by the fact that if you make any other changes to the view, the dependencies list is correctly updated. But if you just delete the display and save the view, the problem will be there.

Steps to reproduce

In a fresh standard install, I did:

1. Create a custom field (field_example) on the Article content type.

2. Create a view (id: example) for articles with a page display listing titles.

3. Create a block display and add (only for that display) the field_example on fields section; save view after that.

4. Run drush cex, so I can see the field_example listed as dependency on views.view.example.yml.

dependencies:
  config:
    - field.storage.node.field_example
  module:
    - node
    - user

5. Open view for editing again; delete the block display and save.

6. Run drush cex again. The view's configuration file is updated.

If you inspect the views.view.example.yml in that moment, the block display is gone, but the field_example continues listed on dependencies.config section. There is no other reference to the field except that.

Furthermore, if you try to delete field_example, the view is listed to be deleted together.

I also tested with a custom user role. I put it as an access requirement on a display and deleted the display after that. The same happened: the role continued listed as view's dependency.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡§πŸ‡·Brazil gedvan JoΓ£o Pessoa

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.

Production build 0.71.5 2024