Views temp store should be cleared or not preserved when the views schema changes

Created on 6 March 2017, over 7 years ago
Updated 3 August 2023, about 1 year ago

Problem/Motivation

Discussed this with @lendude in IRC. Views are stored in a temp store whilst a user is creating a view. These unsaved views can be persisted for a long time. At the moment if the view structure changes as a result of update.php being run we don't update the views stored in the temp store.

Proposed resolution

If the views schema number changes we should ensure that invalid views are not created when someone continues editting a view after an update. The simple solution is to clear the temp store on update. Another solution would be to add the views schema to key - but the problem here is that it is not just views schema that is involved in creating a view - it can be anything that provides a views plugin.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
Views UIΒ  β†’

Last updated 9 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

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.

  • πŸ‡¬πŸ‡§United Kingdom catch

    This seems like a possible use case for a hook that runs every time after updates have run, but separate from hook_flush_caches(), like hook_after_updates_cleanup() or something like that?

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    That would solve the timing issue, but I think it would still be good to somehow figure out if something changed in Views data/schema before flushing the temp storage, but no idea how we could do that accurately.

    Alternatively we could add config checking to saving Views, something like ✨ Provide a way to validate the current configuration state Needs work or what https://www.drupal.org/project/config_inspector β†’ does and block saving a temp View when it's config isn't valid for the current schema versions

  • πŸ‡¬πŸ‡§United Kingdom catch

    That would solve the timing issue, but I think it would still be good to somehow figure out if something changed in Views data/schema before flushing the temp storage

    There is @joachim's idea to store a hash of views data in key/value or similar - but while that would work if we compared it on every cache clear, it won't work in a post-deploy hook, because then the hash would already have been updated and match views data before we get there (usually).

Production build 0.71.5 2024