- ๐ณ๐ฟNew Zealand danielveza Brisbane, AU
I wonder if we could add a
ConfigEvents::IMPORT
EventSubscriber and useConfigImporterEvent::getChangelist
to find any displays that are going to be updated, and clear the tempstore for just those displays.I guess we need to consider if deleting the tempstore on import is considered data loss or not. If it's something that we don't want to implement in core I'm pretty sure this would be a pretty easy contrib module to make.
- ๐ง๐ชBelgium herved
We ran into this issue after switching to layout_builder on a project.
Itโs made worse by the fact that the tempstore is auto-saved whenever you visit a layout builder display (seeDrupal\layout_builder\EventSubscriber\PrepareLayout::onPrepareLayout
), unlike views for example. Those expire after a week. So when working on displays, you almost always end up with tempstore entries locally, leading to the issues below.This really feels like a bug for two reasons:
1. It causes confusion, since changes are not visible on the layout builder display pages after a config:import
2. Deleting a computed / extra field / layout etc, then accessing the layout builder display causes a fatal error because the corresponding plugin cannot be foundโand layout builder cannot recover.Here is a possible solution, crude but effective:
/** * Implements hook_cache_flush(). */ #[Hook('cache_flush')] public function cacheFlush(): void { // Clear layout_builder defaults section storage tempstore on cache flush. // @see https://www.drupal.org/i/3310897 \Drupal::database() ->delete('key_value_expire') ->condition('collection', 'tempstore.shared.layout_builder.section_storage.defaults') ->execute(); }