ViewsConfigUpdater $deprecationsEnabled flag does not persist to preSave hook

Created on 9 June 2025, 5 days ago

Problem/Motivation

In πŸ› Remove duplicate "add block" link from block content type view's "Results not found" message Postponed we are adding a new post update hook that updates views configs. This has started triggering deprecation errors from other views post update hooks (at this time views_post_update_table_css_class) because ViewsConfigUpdater is created using the classResolver pattern in both the post_update and ViewsHooks::viewPresave which means $view_config_updater->setDeprecationsEnabled(FALSE); does not persist from the post update to the presave.

This is compounded by the fact that for every views post update hook, the presave is called and then all views updates are run again on every view since the presave runs updateAll. This should be fixed in a separate issue.

Steps to reproduce

See https://git.drupalcode.org/issue/drupal-3095893/-/jobs/5480383

Proposed resolution

Turn ViewsConfigUpdater into a service so the class property persists.

Remaining tasks

Review
Commit

API changes

ViewsConfigUpdater is now a service

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

views.module

Created by

πŸ‡¦πŸ‡ΊAustralia acbramley

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

Merge Requests

Comments & Activities

  • Issue created by @acbramley
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Failed
    5 days ago
    Total: 129s
    #518147
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Success
    5 days ago
    Total: 2065s
    #518151
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Something we can get a test for?

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    To do that we need to add public API for getting the deprecationsEnabled flag, IMO this is covered by the other issue but I can see value in keeping a test around.

    I've pushed something up. The test only run will fail but that'll be because the service doesn't exist so you'll have to manually edit the post update + presave hooks to see that.

  • Pipeline finished with Failed
    4 days ago
    Total: 146s
    #519198
  • Pipeline finished with Failed
    4 days ago
    Total: 122s
    #519207
  • Pipeline finished with Failed
    4 days ago
    Total: 504s
    #519211
  • Pipeline finished with Failed
    4 days ago
    Total: 150s
    #519222
  • Pipeline finished with Success
    4 days ago
    Total: 1100s
    #519226
  • Pipeline finished with Failed
    4 days ago
    Total: 899s
    #519271
  • Pipeline finished with Success
    4 days ago
    Total: 882s
    #519280
Production build 0.71.5 2024