ViewsConfigUpdater updates run many times for each update

Created on 10 June 2025, 5 days ago

Problem/Motivation

When debugging 🐛 ViewsConfigUpdater $deprecationsEnabled flag does not persist to preSave hook Active I noticed that the process functions in ViewsConfigUpdater were running many times for the same view. processTableCssClassUpdate is probably the worst example of this where it runs >10 times for a single update hook.

This is for 2 reasons:
1. needsTableCssClassUpdate uses processDisplayHandlers which runs through a bunch of different types of displays, but processTableCssClassUpdate just takes the view. I think this wrapper could be removed entirely.
2. The main reason - for each update that runs and returns TRUE, a save happens on the view config entity. This triggers ViewsHooks::viewPresave which runs ViewsConfigUpdater::updateAll, which will run all updates again which also wraps them in the processDisplayHandlers loops.

This could become extremely slow for sites with a lot of views.

Steps to reproduce

Add a breakpoint into ViewsConfigUpdater::processTableCssClassUpdate with a condition on a particular view id
Count how many times it breaks.

Proposed resolution

Remove processDisplayHandlers where it's not needed
Figure out how we track which updates have run on which views and don't run them again?

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 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

Comments & Activities

Production build 0.71.5 2024